/* Read in a LEB128 encoded value starting at address DATA.
If SIGN is true, return a signed LEB128 value.
If LENGTH_RETURN is not NULL, return in it the number of bytes read.
+ If STATUS_RETURN in not NULL, return with bit 0 (LSB) set if the
+ terminating byte was not found and with bit 1 set if the value
+ overflows a dwarf_vma.
No bytes will be read at address END or beyond. */
dwarf_vma
read_leb128 (unsigned char *data,
- unsigned int *length_return,
+ const unsigned char *const end,
bfd_boolean sign,
- const unsigned char * const end)
+ unsigned int *length_return,
+ int *status_return)
{
dwarf_vma result = 0;
unsigned int num_read = 0;
unsigned int shift = 0;
- unsigned char byte = 0;
+ int status = 1;
while (data < end)
{
- byte = *data++;
+ unsigned char byte = *data++;
num_read++;
- result |= ((dwarf_vma) (byte & 0x7f)) << shift;
+ if (shift < sizeof (result) * 8)
+ {
+ result |= ((dwarf_vma) (byte & 0x7f)) << shift;
+ if ((result >> shift) != (byte & 0x7f))
+ /* Overflow. */
+ status |= 2;
+ shift += 7;
+ }
+ else if ((byte & 0x7f) != 0)
+ status |= 2;
- shift += 7;
if ((byte & 0x80) == 0)
- break;
-
- /* PR 17512: file: 0ca183b8.
- FIXME: Should we signal this error somehow ? */
- if (shift >= sizeof (result) * 8)
- break;
+ {
+ status &= ~1;
+ if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40))
+ result |= -((dwarf_vma) 1 << shift);
+ break;
+ }
}
if (length_return != NULL)
*length_return = num_read;
-
- if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40))
- result |= -((dwarf_vma) 1 << shift);
+ if (status_return != NULL)
+ *status_return = status;
return result;
}
-/* Create a signed version to avoid painful typecasts. */
-static inline dwarf_signed_vma
-read_sleb128 (unsigned char * data,
- unsigned int * length_return,
- const unsigned char * const end)
-{
- return (dwarf_signed_vma) read_leb128 (data, length_return, TRUE, end);
-}
-
-static inline dwarf_vma
-read_uleb128 (unsigned char * data,
- unsigned int * length_return,
- const unsigned char * const end)
-{
- return read_leb128 (data, length_return, FALSE, end);
-}
-
-#define SKIP_ULEB() read_uleb128 (start, & length_return, end); start += length_return
-#define SKIP_SLEB() read_sleb128 (start, & length_return, end); start += length_return
-
-#define READ_ULEB(var) \
- do \
- { \
- dwarf_vma _val; \
- \
- (var) = _val = read_uleb128 (start, &length_return, end); \
- if ((var) != _val) \
- error (_("Internal error: %s:%d: LEB value (%s) " \
- "too large for containing variable\n"), \
- __FILE__, __LINE__, dwarf_vmatoa ("u", _val)); \
- start += length_return; \
- } \
- while (0)
-
-#define READ_SLEB(var) \
- do \
- { \
- dwarf_signed_vma _val; \
- \
- (var) = _val = read_sleb128 (start, &length_return, end); \
- if ((var) != _val) \
- error (_("Internal error: %s:%d: LEB value (%s) " \
- "too large for containing variable\n"), \
- __FILE__, __LINE__, dwarf_vmatoa ("d", _val)); \
- start += length_return; \
- } \
- while (0)
-
/* Read AMOUNT bytes from PTR and store them in VAL as an unsigned value.
Checks to make sure that the read will not reach or pass END
and that VAL is big enough to hold AMOUNT bytes. */
/* Handled an extend line op.
Returns the number of bytes read. */
-static int
+static size_t
process_extended_line_op (unsigned char * data,
int is_stmt,
unsigned char * end)
{
unsigned char op_code;
- unsigned int bytes_read;
- unsigned int len;
+ size_t len, header_len;
unsigned char *name;
unsigned char *orig_data = data;
- dwarf_vma adr;
+ dwarf_vma adr, val;
- len = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_ULEB (len, data, end);
+ header_len = data - orig_data;
- if (len == 0 || data == end || len > (uintptr_t) (end - data))
+ if (len == 0 || data == end || len > (size_t) (end - data))
{
warn (_("Badly formed extended line op encountered!\n"));
- return bytes_read;
+ return header_len;
}
- len += bytes_read;
op_code = *data++;
printf (_(" Extended opcode %d: "), op_code);
case DW_LNE_set_address:
/* PR 17512: file: 002-100480-0.004. */
- if (len - bytes_read - 1 > 8)
+ if (len - 1 > 8)
{
- warn (_("Length (%d) of DW_LNE_set_address op is too long\n"),
- len - bytes_read - 1);
+ warn (_("Length (%lu) of DW_LNE_set_address op is too long\n"),
+ (unsigned long) len - 1);
adr = 0;
}
else
- SAFE_BYTE_GET (adr, data, len - bytes_read - 1, end);
+ SAFE_BYTE_GET (adr, data, len - 1, end);
printf (_("set Address to 0x%s\n"), dwarf_vmatoa ("x", adr));
state_machine_regs.address = adr;
state_machine_regs.view = 0;
name = data;
l = strnlen ((char *) data, end - data);
- data += len + 1;
- printf ("%s\t", dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end)));
- data += bytes_read;
- printf ("%s\t", dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end)));
- data += bytes_read;
- printf ("%s\t", dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end)));
- data += bytes_read;
+ data += l + 1;
+ READ_ULEB (val, data, end);
+ printf ("%s\t", dwarf_vmatoa ("u", val));
+ READ_ULEB (val, data, end);
+ printf ("%s\t", dwarf_vmatoa ("u", val));
+ READ_ULEB (val, data, end);
+ printf ("%s\t", dwarf_vmatoa ("u", val));
printf ("%.*s\n\n", (int) l, name);
}
- if (((unsigned int) (data - orig_data) != len) || data == end)
+ if (((size_t) (data - orig_data) != len + header_len) || data == end)
warn (_("DW_LNE_define_file: Bad opcode length\n"));
break;
case DW_LNE_set_discriminator:
- printf (_("set Discriminator to %s\n"),
- dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end)));
+ READ_ULEB (val, data, end);
+ printf (_("set Discriminator to %s\n"), dwarf_vmatoa ("u", val));
break;
/* HP extensions. */
break;
case DW_LNE_HP_source_file_correlation:
{
- unsigned char *edata = data + len - bytes_read - 1;
+ unsigned char *edata = data + len - 1;
printf ("DW_LNE_HP_source_file_correlation\n");
{
unsigned int opc;
- opc = read_uleb128 (data, & bytes_read, edata);
- data += bytes_read;
+ READ_ULEB (opc, data, edata);
switch (opc)
{
printf (" DW_LNE_HP_SFC_formfeed\n");
break;
case DW_LNE_HP_SFC_set_listing_line:
+ READ_ULEB (val, data, edata);
printf (" DW_LNE_HP_SFC_set_listing_line (%s)\n",
- dwarf_vmatoa ("u",
- read_uleb128 (data, & bytes_read, edata)));
- data += bytes_read;
+ dwarf_vmatoa ("u", val));
break;
case DW_LNE_HP_SFC_associate:
printf (" DW_LNE_HP_SFC_associate ");
- printf ("(%s",
- dwarf_vmatoa ("u",
- read_uleb128 (data, & bytes_read, edata)));
- data += bytes_read;
- printf (",%s",
- dwarf_vmatoa ("u",
- read_uleb128 (data, & bytes_read, edata)));
- data += bytes_read;
- printf (",%s)\n",
- dwarf_vmatoa ("u",
- read_uleb128 (data, & bytes_read, edata)));
- data += bytes_read;
+ READ_ULEB (val, data, edata);
+ printf ("(%s", dwarf_vmatoa ("u", val));
+ READ_ULEB (val, data, edata);
+ printf (",%s", dwarf_vmatoa ("u", val));
+ READ_ULEB (val, data, edata);
+ printf (",%s)\n", dwarf_vmatoa ("u", val));
break;
default:
printf (_(" UNKNOWN DW_LNE_HP_SFC opcode (%u)\n"), opc);
default:
{
- unsigned int rlen = len - bytes_read - 1;
+ unsigned int rlen = len - 1;
if (op_code >= DW_LNE_lo_user
/* The test against DW_LNW_hi_user is redundant due to
break;
}
- return len;
+ return len + header_len;
}
static const unsigned char *
while (start < end)
{
- unsigned int bytes_read;
unsigned long entry;
unsigned long tag;
unsigned long attribute;
int children;
- entry = read_uleb128 (start, & bytes_read, end);
- start += bytes_read;
+ READ_ULEB (entry, start, end);
/* A single zero is supposed to end the section according
to the standard. If there's more, then signal that to
if (entry == 0)
return start;
- tag = read_uleb128 (start, & bytes_read, end);
- start += bytes_read;
+ READ_ULEB (tag, start, end);
if (start == end)
return NULL;
/* Initialize it due to a false compiler warning. */
bfd_signed_vma implicit_const = -1;
- attribute = read_uleb128 (start, & bytes_read, end);
- start += bytes_read;
+ READ_ULEB (attribute, start, end);
if (start == end)
break;
- form = read_uleb128 (start, & bytes_read, end);
- start += bytes_read;
+ READ_ULEB (form, start, end);
if (start == end)
break;
if (form == DW_FORM_implicit_const)
{
- implicit_const = read_sleb128 (start, & bytes_read, end);
- start += bytes_read;
+ READ_SLEB (implicit_const, start, end);
if (start == end)
break;
}
struct dwarf_section * section)
{
unsigned op;
- unsigned int bytes_read;
dwarf_vma uvalue;
dwarf_signed_vma svalue;
unsigned char *end = data + length;
printf ("%ld", (long) svalue);
break;
case DW_OP_constu:
- printf ("DW_OP_constu: %s",
- dwarf_vmatoa ("u", read_uleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
+ printf ("DW_OP_constu: %s", dwarf_vmatoa ("u", uvalue));
break;
case DW_OP_consts:
- printf ("DW_OP_consts: %s",
- dwarf_vmatoa ("d", read_sleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ READ_SLEB (svalue, data, end);
+ printf ("DW_OP_consts: %s", dwarf_vmatoa ("d", svalue));
break;
case DW_OP_dup:
printf ("DW_OP_dup");
printf ("DW_OP_plus");
break;
case DW_OP_plus_uconst:
- printf ("DW_OP_plus_uconst: %s",
- dwarf_vmatoa ("u", read_uleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
+ printf ("DW_OP_plus_uconst: %s", dwarf_vmatoa ("u", uvalue));
break;
case DW_OP_shl:
printf ("DW_OP_shl");
case DW_OP_breg29:
case DW_OP_breg30:
case DW_OP_breg31:
- printf ("DW_OP_breg%d (%s): %s",
- op - DW_OP_breg0,
- regname (op - DW_OP_breg0, 1),
- dwarf_vmatoa ("d", read_sleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ READ_SLEB (svalue, data, end);
+ printf ("DW_OP_breg%d (%s): %s", op - DW_OP_breg0,
+ regname (op - DW_OP_breg0, 1), dwarf_vmatoa ("d", svalue));
break;
case DW_OP_regx:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf ("DW_OP_regx: %s (%s)",
dwarf_vmatoa ("u", uvalue), regname (uvalue, 1));
break;
case DW_OP_fbreg:
need_frame_base = 1;
- printf ("DW_OP_fbreg: %s",
- dwarf_vmatoa ("d", read_sleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ READ_SLEB (svalue, data, end);
+ printf ("DW_OP_fbreg: %s", dwarf_vmatoa ("d", svalue));
break;
case DW_OP_bregx:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
+ READ_SLEB (svalue, data, end);
printf ("DW_OP_bregx: %s (%s) %s",
dwarf_vmatoa ("u", uvalue), regname (uvalue, 1),
- dwarf_vmatoa ("d", read_sleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ dwarf_vmatoa ("d", svalue));
break;
case DW_OP_piece:
- printf ("DW_OP_piece: %s",
- dwarf_vmatoa ("u", read_uleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
+ printf ("DW_OP_piece: %s", dwarf_vmatoa ("u", uvalue));
break;
case DW_OP_deref_size:
SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
break;
case DW_OP_bit_piece:
printf ("DW_OP_bit_piece: ");
- printf (_("size: %s "),
- dwarf_vmatoa ("u", read_uleb128 (data, &bytes_read, end)));
- data += bytes_read;
- printf (_("offset: %s "),
- dwarf_vmatoa ("u", read_uleb128 (data, &bytes_read, end)));
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
+ printf (_("size: %s "), dwarf_vmatoa ("u", uvalue));
+ READ_ULEB (uvalue, data, end);
+ printf (_("offset: %s "), dwarf_vmatoa ("u", uvalue));
break;
/* DWARF 4 extensions. */
case DW_OP_implicit_value:
printf ("DW_OP_implicit_value");
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
data = display_block (data, uvalue, end, ' ');
break;
{
SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
}
+ READ_SLEB (svalue, data, end);
printf ("%s: <0x%s> %s",
(op == DW_OP_implicit_pointer
? "DW_OP_implicit_pointer" : "DW_OP_GNU_implicit_pointer"),
dwarf_vmatoa ("x", uvalue),
- dwarf_vmatoa ("d", read_sleb128 (data,
- &bytes_read, end)));
- data += bytes_read;
+ dwarf_vmatoa ("d", svalue));
break;
case DW_OP_entry_value:
case DW_OP_GNU_entry_value:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
/* PR 17531: file: 0cc9cd00. */
if (uvalue > (dwarf_vma) (end - data))
uvalue = end - data;
break;
case DW_OP_const_type:
case DW_OP_GNU_const_type:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf ("%s: <0x%s> ",
(op == DW_OP_const_type ? "DW_OP_const_type"
: "DW_OP_GNU_const_type"),
break;
case DW_OP_regval_type:
case DW_OP_GNU_regval_type:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf ("%s: %s (%s)",
(op == DW_OP_regval_type ? "DW_OP_regval_type"
: "DW_OP_GNU_regval_type"),
dwarf_vmatoa ("u", uvalue), regname (uvalue, 1));
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf (" <0x%s>", dwarf_vmatoa ("x", cu_offset + uvalue));
break;
case DW_OP_deref_type:
(op == DW_OP_deref_type ? "DW_OP_deref_type"
: "DW_OP_GNU_deref_type"),
(long) uvalue);
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf (" <0x%s>", dwarf_vmatoa ("x", cu_offset + uvalue));
break;
case DW_OP_convert:
case DW_OP_GNU_convert:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf ("%s <0x%s>",
(op == DW_OP_convert ? "DW_OP_convert" : "DW_OP_GNU_convert"),
dwarf_vmatoa ("x", uvalue ? cu_offset + uvalue : 0));
break;
case DW_OP_reinterpret:
case DW_OP_GNU_reinterpret:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf ("%s <0x%s>",
(op == DW_OP_reinterpret ? "DW_OP_reinterpret"
: "DW_OP_GNU_reinterpret"),
dwarf_vmatoa ("x", cu_offset + uvalue));
break;
case DW_OP_GNU_addr_index:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf ("DW_OP_GNU_addr_index <0x%s>", dwarf_vmatoa ("x", uvalue));
break;
case DW_OP_GNU_const_index:
- uvalue = read_uleb128 (data, &bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
printf ("DW_OP_GNU_const_index <0x%s>", dwarf_vmatoa ("x", uvalue));
break;
case DW_OP_GNU_variable_value:
int dwarf_version,
dwarf_vma * value_return)
{
- unsigned int bytes_read;
- dwarf_vma uvalue = 0;
+ dwarf_signed_vma svalue;
+ dwarf_vma uvalue = 0;
* value_return = 0;
break;
case DW_FORM_sdata:
- uvalue = read_sleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_SLEB (svalue, data, end);
+ uvalue = svalue;
break;
case DW_FORM_ref_udata:
case DW_FORM_udata:
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_addr_index:
- uvalue = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_ULEB (uvalue, data, end);
break;
case DW_FORM_ref8:
case DW_FORM_block:
case DW_FORM_exprloc:
- uvalue = read_uleb128 (data, & bytes_read, end);
- data += bytes_read + uvalue;
+ READ_ULEB (uvalue, data, end);
break;
case DW_FORM_block1:
bfd_boolean is_nested)
{
unsigned long abbrev_number;
- unsigned int bytes_read;
abbrev_entry * entry;
abbrev_attr * attr;
* is_signed = FALSE;
- abbrev_number = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_ULEB (abbrev_number, data, end);
for (entry = first_abbrev;
entry != NULL && entry->entry != abbrev_number;
unsigned const char * end,
bfd_boolean is_signed)
{
- if (is_signed)
- {
- dwarf_signed_vma sval = read_sleb128 (data, bytes_read, end);
- printf ("%ld", (long) sval);
- }
+ int status;
+ dwarf_vma val = read_leb128 (data, end, is_signed, bytes_read, &status);
+ if (status != 0)
+ report_leb_status (status);
else
- {
- dwarf_vma uval = read_uleb128 (data, bytes_read, end);
- printf ("%lu", (unsigned long) uval);
- }
+ printf ("%s", dwarf_vmatoa (is_signed ? "d" : "u", val));
}
static void
char delimiter,
int level)
{
+ dwarf_signed_vma svalue;
dwarf_vma uvalue = 0;
unsigned char * block_start = NULL;
unsigned char * orig_data = data;
- unsigned int bytes_read;
if (data > end || (data == end && form != DW_FORM_flag_present))
{
break;
case DW_FORM_sdata:
- uvalue = read_sleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_SLEB (svalue, data, end);
+ uvalue = svalue;
break;
case DW_FORM_GNU_str_index:
- uvalue = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- break;
-
case DW_FORM_ref_udata:
case DW_FORM_udata:
- uvalue = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ case DW_FORM_GNU_addr_index:
+ READ_ULEB (uvalue, data, end);
break;
case DW_FORM_indirect:
- form = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_ULEB (form, data, end);
if (!do_loc)
printf ("%c%s", delimiter, get_FORM_name (form));
if (form == DW_FORM_implicit_const)
- {
- implicit_const = read_sleb128 (data, & bytes_read, end);
- data += bytes_read;
- }
+ READ_SLEB (implicit_const, data, end);
return read_and_display_attr_value (attribute, form, implicit_const,
start, data, end,
cu_offset, pointer_size,
offset_size, dwarf_version,
debug_info_p, do_loc,
section, this_set, delimiter, level);
- case DW_FORM_GNU_addr_index:
- uvalue = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- break;
}
switch (form)
case DW_FORM_block:
case DW_FORM_exprloc:
- uvalue = read_uleb128 (data, & bytes_read, end);
- block_start = data + bytes_read;
+ READ_ULEB (uvalue, data, end);
+ do_block:
+ block_start = data;
if (block_start >= end)
{
warn (_("Block ends prematurely\n"));
break;
case DW_FORM_block1:
- SAFE_BYTE_GET (uvalue, data, 1, end);
- block_start = data + 1;
- if (block_start >= end)
- {
- warn (_("Block ends prematurely\n"));
- uvalue = 0;
- block_start = end;
- }
-
- uvalue = check_uvalue (block_start, uvalue, end);
-
- if (do_loc)
- data = block_start + uvalue;
- else
- data = display_block (block_start, uvalue, end, delimiter);
- break;
+ SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
+ goto do_block;
case DW_FORM_block2:
- SAFE_BYTE_GET (uvalue, data, 2, end);
- block_start = data + 2;
- if (block_start >= end)
- {
- warn (_("Block ends prematurely\n"));
- uvalue = 0;
- block_start = end;
- }
-
- uvalue = check_uvalue (block_start, uvalue, end);
-
- if (do_loc)
- data = block_start + uvalue;
- else
- data = display_block (block_start, uvalue, end, delimiter);
- break;
+ SAFE_BYTE_GET_AND_INC (uvalue, data, 2, end);
+ goto do_block;
case DW_FORM_block4:
- SAFE_BYTE_GET (uvalue, data, 4, end);
- block_start = data + 4;
- /* PR 17512: file: 3371-3907-0.004. */
- if (block_start >= end)
- {
- warn (_("Block ends prematurely\n"));
- uvalue = 0;
- block_start = end;
- }
-
- uvalue = check_uvalue (block_start, uvalue, end);
-
- if (do_loc)
- data = block_start + uvalue;
- else
- data = display_block (block_start, uvalue, end, delimiter);
- break;
+ SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end);
+ goto do_block;
case DW_FORM_strp:
if (!do_loc)
else
{
unsigned long abbrev_number;
- abbrev_entry * entry;
+ abbrev_entry *entry;
+ unsigned char *p = section->start + uvalue;
- abbrev_number = read_uleb128 (section->start + uvalue, NULL, end);
+ READ_ULEB (abbrev_number, p, end);
printf (_("\t[Abbrev Number: %ld"), abbrev_number);
/* Don't look up abbrev for DW_FORM_ref_addr, as it very often will
saved_level = -1;
while (tags < start)
{
- unsigned int bytes_read;
unsigned long abbrev_number;
unsigned long die_offset;
abbrev_entry *entry;
die_offset = tags - section_begin;
- abbrev_number = read_uleb128 (tags, & bytes_read, start);
- tags += bytes_read;
+ READ_ULEB (abbrev_number, tags, start);
/* A null DIE marks the end of a list of siblings or it may also be
a section padding. */
{
unsigned char *format_start, format_count, *format, formati;
dwarf_vma data_count, datai;
- unsigned int bytes_read, namepass, last_entry = 0;
+ unsigned int namepass, last_entry = 0;
SAFE_BYTE_GET_AND_INC (format_count, data, 1, end);
format_start = data;
for (formati = 0; formati < format_count; formati++)
{
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ SKIP_ULEB (data, end);
+ SKIP_ULEB (data, end);
if (data == end)
{
if (is_dir)
}
}
- data_count = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_ULEB (data_count, data, end);
if (data == end)
{
if (is_dir)
{
dwarf_vma content_type;
- content_type = read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
+ READ_ULEB (content_type, format, end);
if ((content_type == DW_LNCT_path) == (namepass == 1))
switch (content_type)
{
printf (_("\t(Unknown format content type %s)"),
dwarf_vmatoa ("u", content_type));
}
- read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
+ SKIP_ULEB (format, end);
}
}
putchar ('\n');
{
dwarf_vma content_type, form;
- content_type = read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
- form = read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
- data = read_and_display_attr_value (0, form, 0, start, data, end, 0, 0,
- linfo->li_offset_size,
+ READ_ULEB (content_type, format, end);
+ READ_ULEB (form, format, end);
+ data = read_and_display_attr_value (0, form, 0, start, data, end,
+ 0, 0, linfo->li_offset_size,
linfo->li_version, NULL,
((content_type == DW_LNCT_path) != (namepass == 1)),
section, NULL, '\t', -1);
while (data < end && *data != 0)
{
unsigned char *name;
- unsigned int bytes_read;
+ dwarf_vma val;
printf (" %d\t", ++state_machine_regs.last_file_entry);
name = data;
data += strnlen ((char *) data, end - data) + 1;
- printf ("%s\t",
- dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end)));
- data += bytes_read;
- printf ("%s\t",
- dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end)));
- data += bytes_read;
- printf ("%s\t",
- dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end)));
- data += bytes_read;
+ READ_ULEB (val, data, end);
+ printf ("%s\t", dwarf_vmatoa ("u", val));
+ READ_ULEB (val, data, end);
+ printf ("%s\t", dwarf_vmatoa ("u", val));
+ READ_ULEB (val, data, end);
+ printf ("%s\t", dwarf_vmatoa ("u", val));
printf ("%.*s\n", (int)(end - name), name);
if (data == end)
unsigned char op_code;
dwarf_signed_vma adv;
dwarf_vma uladv;
- unsigned int bytes_read;
printf (" [0x%08lx]", (long)(data - start));
putchar ('\n');
state_machine_regs.view++;
}
- else switch (op_code)
- {
- case DW_LNS_extended_op:
- data += process_extended_line_op (data, linfo.li_default_is_stmt, end);
- break;
-
- case DW_LNS_copy:
- printf (_(" Copy"));
- if (verbose_view || state_machine_regs.view)
- printf (_(" (view %u)\n"), state_machine_regs.view);
- else
- putchar ('\n');
- state_machine_regs.view++;
- break;
-
- case DW_LNS_advance_pc:
- uladv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- if (linfo.li_max_ops_per_insn == 1)
- {
- uladv *= linfo.li_min_insn_length;
- state_machine_regs.address += uladv;
- if (uladv)
- state_machine_regs.view = 0;
- printf (_(" Advance PC by %s to 0x%s%s\n"),
- dwarf_vmatoa ("u", uladv),
- dwarf_vmatoa ("x", state_machine_regs.address),
- verbose_view && uladv
- ? _(" (reset view)") : "");
- }
- else
- {
- unsigned addrdelta
- = ((state_machine_regs.op_index + uladv)
- / linfo.li_max_ops_per_insn)
- * linfo.li_min_insn_length;
- state_machine_regs.address
- += addrdelta;
- state_machine_regs.op_index
- = (state_machine_regs.op_index + uladv)
- % linfo.li_max_ops_per_insn;
- if (addrdelta)
- state_machine_regs.view = 0;
- printf (_(" Advance PC by %s to 0x%s[%d]%s\n"),
- dwarf_vmatoa ("u", uladv),
- dwarf_vmatoa ("x", state_machine_regs.address),
- state_machine_regs.op_index,
- verbose_view && addrdelta
- ? _(" (reset view)") : "");
- }
- break;
-
- case DW_LNS_advance_line:
- adv = read_sleb128 (data, & bytes_read, end);
- data += bytes_read;
- state_machine_regs.line += adv;
- printf (_(" Advance Line by %s to %d\n"),
- dwarf_vmatoa ("d", adv),
- state_machine_regs.line);
- break;
-
- case DW_LNS_set_file:
- adv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- printf (_(" Set File Name to entry %s in the File Name Table\n"),
- dwarf_vmatoa ("d", adv));
- state_machine_regs.file = adv;
- break;
-
- case DW_LNS_set_column:
- uladv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- printf (_(" Set column to %s\n"),
- dwarf_vmatoa ("u", uladv));
- state_machine_regs.column = uladv;
- break;
-
- case DW_LNS_negate_stmt:
- adv = state_machine_regs.is_stmt;
- adv = ! adv;
- printf (_(" Set is_stmt to %s\n"), dwarf_vmatoa ("d", adv));
- state_machine_regs.is_stmt = adv;
- break;
-
- case DW_LNS_set_basic_block:
- printf (_(" Set basic block\n"));
- state_machine_regs.basic_block = 1;
- break;
-
- case DW_LNS_const_add_pc:
- uladv = ((255 - linfo.li_opcode_base) / linfo.li_line_range);
- if (linfo.li_max_ops_per_insn)
- {
- uladv *= linfo.li_min_insn_length;
- state_machine_regs.address += uladv;
- if (uladv)
- state_machine_regs.view = 0;
- printf (_(" Advance PC by constant %s to 0x%s%s\n"),
- dwarf_vmatoa ("u", uladv),
- dwarf_vmatoa ("x", state_machine_regs.address),
- verbose_view && uladv
- ? _(" (reset view)") : "");
- }
- else
- {
- unsigned addrdelta
- = ((state_machine_regs.op_index + uladv)
- / linfo.li_max_ops_per_insn)
- * linfo.li_min_insn_length;
- state_machine_regs.address
- += addrdelta;
- state_machine_regs.op_index
- = (state_machine_regs.op_index + uladv)
- % linfo.li_max_ops_per_insn;
- if (addrdelta)
- state_machine_regs.view = 0;
- printf (_(" Advance PC by constant %s to 0x%s[%d]%s\n"),
- dwarf_vmatoa ("u", uladv),
- dwarf_vmatoa ("x", state_machine_regs.address),
- state_machine_regs.op_index,
- verbose_view && addrdelta
- ? _(" (reset view)") : "");
- }
- break;
-
- case DW_LNS_fixed_advance_pc:
- SAFE_BYTE_GET_AND_INC (uladv, data, 2, end);
- state_machine_regs.address += uladv;
- state_machine_regs.op_index = 0;
- printf (_(" Advance PC by fixed size amount %s to 0x%s\n"),
- dwarf_vmatoa ("u", uladv),
- dwarf_vmatoa ("x", state_machine_regs.address));
- /* Do NOT reset view. */
- break;
-
- case DW_LNS_set_prologue_end:
- printf (_(" Set prologue_end to true\n"));
- break;
-
- case DW_LNS_set_epilogue_begin:
- printf (_(" Set epilogue_begin to true\n"));
- break;
-
- case DW_LNS_set_isa:
- uladv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- printf (_(" Set ISA to %s\n"), dwarf_vmatoa ("u", uladv));
- break;
-
- default:
- printf (_(" Unknown opcode %d with operands: "), op_code);
-
- if (standard_opcodes != NULL)
- for (i = standard_opcodes[op_code - 1]; i > 0 ; --i)
- {
- printf ("0x%s%s", dwarf_vmatoa ("x", read_uleb128 (data,
- &bytes_read, end)),
- i == 1 ? "" : ", ");
- data += bytes_read;
- }
- putchar ('\n');
- break;
- }
+ else
+ switch (op_code)
+ {
+ case DW_LNS_extended_op:
+ data += process_extended_line_op (data,
+ linfo.li_default_is_stmt,
+ end);
+ break;
+
+ case DW_LNS_copy:
+ printf (_(" Copy"));
+ if (verbose_view || state_machine_regs.view)
+ printf (_(" (view %u)\n"), state_machine_regs.view);
+ else
+ putchar ('\n');
+ state_machine_regs.view++;
+ break;
+
+ case DW_LNS_advance_pc:
+ READ_ULEB (uladv, data, end);
+ if (linfo.li_max_ops_per_insn == 1)
+ {
+ uladv *= linfo.li_min_insn_length;
+ state_machine_regs.address += uladv;
+ if (uladv)
+ state_machine_regs.view = 0;
+ printf (_(" Advance PC by %s to 0x%s%s\n"),
+ dwarf_vmatoa ("u", uladv),
+ dwarf_vmatoa ("x", state_machine_regs.address),
+ verbose_view && uladv
+ ? _(" (reset view)") : "");
+ }
+ else
+ {
+ unsigned addrdelta
+ = ((state_machine_regs.op_index + uladv)
+ / linfo.li_max_ops_per_insn)
+ * linfo.li_min_insn_length;
+ state_machine_regs.address
+ += addrdelta;
+ state_machine_regs.op_index
+ = (state_machine_regs.op_index + uladv)
+ % linfo.li_max_ops_per_insn;
+ if (addrdelta)
+ state_machine_regs.view = 0;
+ printf (_(" Advance PC by %s to 0x%s[%d]%s\n"),
+ dwarf_vmatoa ("u", uladv),
+ dwarf_vmatoa ("x", state_machine_regs.address),
+ state_machine_regs.op_index,
+ verbose_view && addrdelta
+ ? _(" (reset view)") : "");
+ }
+ break;
+
+ case DW_LNS_advance_line:
+ READ_SLEB (adv, data, end);
+ state_machine_regs.line += adv;
+ printf (_(" Advance Line by %s to %d\n"),
+ dwarf_vmatoa ("d", adv),
+ state_machine_regs.line);
+ break;
+
+ case DW_LNS_set_file:
+ READ_ULEB (uladv, data, end);
+ printf (_(" Set File Name to entry %s in the File Name Table\n"),
+ dwarf_vmatoa ("u", uladv));
+ state_machine_regs.file = uladv;
+ break;
+
+ case DW_LNS_set_column:
+ READ_ULEB (uladv, data, end);
+ printf (_(" Set column to %s\n"),
+ dwarf_vmatoa ("u", uladv));
+ state_machine_regs.column = uladv;
+ break;
+
+ case DW_LNS_negate_stmt:
+ adv = state_machine_regs.is_stmt;
+ adv = ! adv;
+ printf (_(" Set is_stmt to %s\n"), dwarf_vmatoa ("d", adv));
+ state_machine_regs.is_stmt = adv;
+ break;
+
+ case DW_LNS_set_basic_block:
+ printf (_(" Set basic block\n"));
+ state_machine_regs.basic_block = 1;
+ break;
+
+ case DW_LNS_const_add_pc:
+ uladv = ((255 - linfo.li_opcode_base) / linfo.li_line_range);
+ if (linfo.li_max_ops_per_insn)
+ {
+ uladv *= linfo.li_min_insn_length;
+ state_machine_regs.address += uladv;
+ if (uladv)
+ state_machine_regs.view = 0;
+ printf (_(" Advance PC by constant %s to 0x%s%s\n"),
+ dwarf_vmatoa ("u", uladv),
+ dwarf_vmatoa ("x", state_machine_regs.address),
+ verbose_view && uladv
+ ? _(" (reset view)") : "");
+ }
+ else
+ {
+ unsigned addrdelta
+ = ((state_machine_regs.op_index + uladv)
+ / linfo.li_max_ops_per_insn)
+ * linfo.li_min_insn_length;
+ state_machine_regs.address
+ += addrdelta;
+ state_machine_regs.op_index
+ = (state_machine_regs.op_index + uladv)
+ % linfo.li_max_ops_per_insn;
+ if (addrdelta)
+ state_machine_regs.view = 0;
+ printf (_(" Advance PC by constant %s to 0x%s[%d]%s\n"),
+ dwarf_vmatoa ("u", uladv),
+ dwarf_vmatoa ("x", state_machine_regs.address),
+ state_machine_regs.op_index,
+ verbose_view && addrdelta
+ ? _(" (reset view)") : "");
+ }
+ break;
+
+ case DW_LNS_fixed_advance_pc:
+ SAFE_BYTE_GET_AND_INC (uladv, data, 2, end);
+ state_machine_regs.address += uladv;
+ state_machine_regs.op_index = 0;
+ printf (_(" Advance PC by fixed size amount %s to 0x%s\n"),
+ dwarf_vmatoa ("u", uladv),
+ dwarf_vmatoa ("x", state_machine_regs.address));
+ /* Do NOT reset view. */
+ break;
+
+ case DW_LNS_set_prologue_end:
+ printf (_(" Set prologue_end to true\n"));
+ break;
+
+ case DW_LNS_set_epilogue_begin:
+ printf (_(" Set epilogue_begin to true\n"));
+ break;
+
+ case DW_LNS_set_isa:
+ READ_ULEB (uladv, data, end);
+ printf (_(" Set ISA to %s\n"), dwarf_vmatoa ("u", uladv));
+ break;
+
+ default:
+ printf (_(" Unknown opcode %d with operands: "), op_code);
+
+ if (standard_opcodes != NULL)
+ for (i = standard_opcodes[op_code - 1]; i > 0 ; --i)
+ {
+ READ_ULEB (uladv, data, end);
+ printf ("0x%s%s", dwarf_vmatoa ("x", uladv),
+ i == 1 ? "" : ", ");
+ }
+ putchar ('\n');
+ break;
+ }
}
putchar ('\n');
}
{
unsigned char *format_start, format_count, *format;
dwarf_vma formati, entryi;
- unsigned int bytes_read;
load_debug_section_with_follow (line_str, fileptr);
format_start = data;
for (formati = 0; formati < format_count; formati++)
{
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ SKIP_ULEB (data, end);
+ SKIP_ULEB (data, end);
}
- n_directories = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_ULEB (n_directories, data, end);
if (data == end)
{
warn (_("Corrupt directories list\n"));
dwarf_vma content_type, form;
dwarf_vma uvalue;
- content_type = read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
- form = read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
+ READ_ULEB (content_type, format, end);
+ READ_ULEB (form, format, end);
if (data == end)
{
warn (_("Corrupt directories list\n"));
}
break;
}
- data = read_and_display_attr_value (0, form, 0, start, data, end,
- 0, 0,
+ data = read_and_display_attr_value (0, form, 0, start,
+ data, end, 0, 0,
linfo.li_offset_size,
linfo.li_version,
NULL, 1, section,
format_start = data;
for (formati = 0; formati < format_count; formati++)
{
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ SKIP_ULEB (data, end);
+ SKIP_ULEB (data, end);
}
- n_files = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
+ READ_ULEB (n_files, data, end);
if (data == end)
{
warn (_("Corrupt file name list\n"));
{
dwarf_vma content_type, form;
dwarf_vma uvalue;
+ unsigned char *tmp;
- content_type = read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
- form = read_uleb128 (format, & bytes_read, end);
- format += bytes_read;
+ READ_ULEB (content_type, format, end);
+ READ_ULEB (form, format, end);
if (data == end)
{
warn (_("Corrupt file name list\n"));
end);
break;
case DW_FORM_udata:
- file->directory_index = read_uleb128 (data, NULL,
- end);
+ tmp = data;
+ READ_ULEB (file->directory_index, tmp, end);
break;
}
break;
}
- data = read_and_display_attr_value (0, form, 0, start, data, end,
- 0, 0,
+ data = read_and_display_attr_value (0, form, 0, start,
+ data, end, 0, 0,
linfo.li_offset_size,
linfo.li_version,
NULL, 1, section,
while (data < end && *data != 0)
{
- unsigned int bytes_read;
-
- /* Skip Name, directory index, last modification time and length
- of file. */
+ /* Skip Name, directory index, last modification
+ time and length of file. */
data += strnlen ((char *) data, end - data) + 1;
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
-
+ SKIP_ULEB (data, end);
+ SKIP_ULEB (data, end);
+ SKIP_ULEB (data, end);
n_files++;
}
i = 0;
while (*ptr_file_name_table != 0)
{
- unsigned int bytes_read;
-
file_table[i].name = ptr_file_name_table;
ptr_file_name_table += strnlen ((char *) ptr_file_name_table,
end - ptr_file_name_table) + 1;
/* We are not interested in directory, time or size. */
- file_table[i].directory_index = read_uleb128 (ptr_file_name_table,
- & bytes_read, end);
- ptr_file_name_table += bytes_read;
- file_table[i].modification_date = read_uleb128 (ptr_file_name_table,
- & bytes_read, end);
- ptr_file_name_table += bytes_read;
- file_table[i].length = read_uleb128 (ptr_file_name_table, & bytes_read, end);
- ptr_file_name_table += bytes_read;
+ READ_ULEB (file_table[i].directory_index,
+ ptr_file_name_table, end);
+ READ_ULEB (file_table[i].modification_date,
+ ptr_file_name_table, end);
+ READ_ULEB (file_table[i].length,
+ ptr_file_name_table, end);
i++;
}
i = 0;
int xop;
int adv;
unsigned long int uladv;
- unsigned int bytes_read;
int is_special_opcode = 0;
op_code = *data++;
is_special_opcode = 1;
/* Increment view after printing this row. */
}
- else switch (op_code)
- {
- case DW_LNS_extended_op:
- {
- unsigned int ext_op_code_len;
- unsigned char ext_op_code;
- unsigned char *op_code_data = data;
-
- ext_op_code_len = read_uleb128 (op_code_data, &bytes_read,
- end_of_sequence);
- op_code_data += bytes_read;
-
- if (ext_op_code_len == 0)
- {
- warn (_("Badly formed extended line op encountered!\n"));
- break;
- }
- ext_op_code_len += bytes_read;
- ext_op_code = *op_code_data++;
- xop = ext_op_code;
- xop = -xop;
-
- switch (ext_op_code)
- {
- case DW_LNE_end_sequence:
- /* Reset stuff after printing this row. */
- break;
- case DW_LNE_set_address:
- SAFE_BYTE_GET_AND_INC (state_machine_regs.address,
- op_code_data,
- ext_op_code_len - bytes_read - 1,
- end);
- state_machine_regs.op_index = 0;
- state_machine_regs.view = 0;
- break;
- case DW_LNE_define_file:
- {
- file_table = (File_Entry *) xrealloc
- (file_table, (n_files + 1) * sizeof (File_Entry));
-
- ++state_machine_regs.last_file_entry;
- /* Source file name. */
- file_table[n_files].name = op_code_data;
- op_code_data += strlen ((char *) op_code_data) + 1;
- /* Directory index. */
- file_table[n_files].directory_index =
- read_uleb128 (op_code_data, & bytes_read,
- end_of_sequence);
- op_code_data += bytes_read;
- /* Last modification time. */
- file_table[n_files].modification_date =
- read_uleb128 (op_code_data, & bytes_read,
- end_of_sequence);
- op_code_data += bytes_read;
- /* File length. */
- file_table[n_files].length =
- read_uleb128 (op_code_data, & bytes_read,
- end_of_sequence);
-
- n_files++;
- break;
- }
- case DW_LNE_set_discriminator:
- case DW_LNE_HP_set_sequence:
- /* Simply ignored. */
- break;
-
- default:
- printf (_("UNKNOWN (%u): length %d\n"),
- ext_op_code, ext_op_code_len - bytes_read);
- break;
- }
- data += ext_op_code_len;
- break;
- }
- case DW_LNS_copy:
- /* Increment view after printing this row. */
- break;
-
- case DW_LNS_advance_pc:
- uladv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- if (linfo.li_max_ops_per_insn == 1)
- {
- uladv *= linfo.li_min_insn_length;
- state_machine_regs.address += uladv;
- if (uladv)
- state_machine_regs.view = 0;
- }
- else
- {
- unsigned addrdelta
- = ((state_machine_regs.op_index + uladv)
- / linfo.li_max_ops_per_insn)
- * linfo.li_min_insn_length;
- state_machine_regs.address
- += addrdelta;
- state_machine_regs.op_index
- = (state_machine_regs.op_index + uladv)
- % linfo.li_max_ops_per_insn;
- if (addrdelta)
- state_machine_regs.view = 0;
- }
- break;
-
- case DW_LNS_advance_line:
- adv = read_sleb128 (data, & bytes_read, end);
- data += bytes_read;
- state_machine_regs.line += adv;
- break;
-
- case DW_LNS_set_file:
- adv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- state_machine_regs.file = adv;
-
- {
- unsigned file = state_machine_regs.file - 1;
- unsigned dir;
-
- if (file_table == NULL || n_files == 0)
- printf (_("\n [Use file table entry %d]\n"), file);
- /* PR 20439 */
- else if (file >= n_files)
- {
- warn (_("file index %u > number of files %u\n"), file + 1, n_files);
- printf (_("\n <over large file table index %u>"), file);
- }
- else if ((dir = file_table[file].directory_index) == 0)
- /* If directory index is 0, that means current directory. */
- printf ("\n./%s:[++]\n", file_table[file].name);
- else if (directory_table == NULL || n_directories == 0)
- printf (_("\n [Use file %s in directory table entry %d]\n"),
- file_table[file].name, dir);
- /* PR 20439 */
- else if (dir > n_directories)
- {
- warn (_("directory index %u > number of directories %s\n"),
- dir, dwarf_vmatoa ("u", n_directories));
- printf (_("\n <over large directory table entry %u>\n"), dir);
- }
- else
- printf ("\n%s/%s:\n",
- /* The directory index starts counting at 1. */
- directory_table[dir - 1], file_table[file].name);
- }
- break;
-
- case DW_LNS_set_column:
- uladv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- state_machine_regs.column = uladv;
- break;
-
- case DW_LNS_negate_stmt:
- adv = state_machine_regs.is_stmt;
- adv = ! adv;
- state_machine_regs.is_stmt = adv;
- break;
-
- case DW_LNS_set_basic_block:
- state_machine_regs.basic_block = 1;
- break;
-
- case DW_LNS_const_add_pc:
- uladv = ((255 - linfo.li_opcode_base) / linfo.li_line_range);
- if (linfo.li_max_ops_per_insn == 1)
- {
- uladv *= linfo.li_min_insn_length;
- state_machine_regs.address += uladv;
- if (uladv)
- state_machine_regs.view = 0;
- }
- else
- {
- unsigned addrdelta
- = ((state_machine_regs.op_index + uladv)
- / linfo.li_max_ops_per_insn)
- * linfo.li_min_insn_length;
- state_machine_regs.address
- += addrdelta;
- state_machine_regs.op_index
- = (state_machine_regs.op_index + uladv)
- % linfo.li_max_ops_per_insn;
- if (addrdelta)
- state_machine_regs.view = 0;
- }
- break;
-
- case DW_LNS_fixed_advance_pc:
- SAFE_BYTE_GET_AND_INC (uladv, data, 2, end);
- state_machine_regs.address += uladv;
- state_machine_regs.op_index = 0;
- /* Do NOT reset view. */
- break;
-
- case DW_LNS_set_prologue_end:
- break;
-
- case DW_LNS_set_epilogue_begin:
- break;
-
- case DW_LNS_set_isa:
- uladv = read_uleb128 (data, & bytes_read, end);
- data += bytes_read;
- printf (_(" Set ISA to %lu\n"), uladv);
- break;
-
- default:
- printf (_(" Unknown opcode %d with operands: "), op_code);
-
- if (standard_opcodes != NULL)
- for (i = standard_opcodes[op_code - 1]; i > 0 ; --i)
- {
- printf ("0x%s%s", dwarf_vmatoa ("x", read_uleb128 (data,
- &bytes_read, end)),
- i == 1 ? "" : ", ");
- data += bytes_read;
- }
- putchar ('\n');
- break;
- }
+ else
+ switch (op_code)
+ {
+ case DW_LNS_extended_op:
+ {
+ unsigned int ext_op_code_len;
+ unsigned char ext_op_code;
+ unsigned char *op_code_end;
+ unsigned char *op_code_data = data;
+
+ READ_ULEB (ext_op_code_len, op_code_data, end_of_sequence);
+ op_code_end = op_code_data + ext_op_code_len;
+ if (ext_op_code_len == 0 || op_code_end > end_of_sequence)
+ {
+ warn (_("Badly formed extended line op encountered!\n"));
+ break;
+ }
+ ext_op_code = *op_code_data++;
+ xop = ext_op_code;
+ xop = -xop;
+
+ switch (ext_op_code)
+ {
+ case DW_LNE_end_sequence:
+ /* Reset stuff after printing this row. */
+ break;
+ case DW_LNE_set_address:
+ SAFE_BYTE_GET_AND_INC (state_machine_regs.address,
+ op_code_data,
+ op_code_end - op_code_data,
+ op_code_end);
+ state_machine_regs.op_index = 0;
+ state_machine_regs.view = 0;
+ break;
+ case DW_LNE_define_file:
+ file_table = (File_Entry *) xrealloc
+ (file_table, (n_files + 1) * sizeof (File_Entry));
+
+ ++state_machine_regs.last_file_entry;
+ /* Source file name. */
+ file_table[n_files].name = op_code_data;
+ op_code_data += strlen ((char *) op_code_data) + 1;
+ /* Directory index. */
+ READ_ULEB (file_table[n_files].directory_index,
+ op_code_data, op_code_end);
+ /* Last modification time. */
+ READ_ULEB (file_table[n_files].modification_date,
+ op_code_data, op_code_end);
+ /* File length. */
+ READ_ULEB (file_table[n_files].length,
+ op_code_data, op_code_end);
+ n_files++;
+ break;
+
+ case DW_LNE_set_discriminator:
+ case DW_LNE_HP_set_sequence:
+ /* Simply ignored. */
+ break;
+
+ default:
+ printf (_("UNKNOWN (%u): length %ld\n"),
+ ext_op_code, op_code_data - data);
+ break;
+ }
+ data = op_code_end;
+ break;
+ }
+ case DW_LNS_copy:
+ /* Increment view after printing this row. */
+ break;
+
+ case DW_LNS_advance_pc:
+ READ_ULEB (uladv, data, end);
+ if (linfo.li_max_ops_per_insn == 1)
+ {
+ uladv *= linfo.li_min_insn_length;
+ state_machine_regs.address += uladv;
+ if (uladv)
+ state_machine_regs.view = 0;
+ }
+ else
+ {
+ unsigned addrdelta
+ = ((state_machine_regs.op_index + uladv)
+ / linfo.li_max_ops_per_insn)
+ * linfo.li_min_insn_length;
+ state_machine_regs.address
+ += addrdelta;
+ state_machine_regs.op_index
+ = (state_machine_regs.op_index + uladv)
+ % linfo.li_max_ops_per_insn;
+ if (addrdelta)
+ state_machine_regs.view = 0;
+ }
+ break;
+
+ case DW_LNS_advance_line:
+ READ_SLEB (adv, data, end);
+ state_machine_regs.line += adv;
+ break;
+
+ case DW_LNS_set_file:
+ READ_ULEB (uladv, data, end);
+ state_machine_regs.file = uladv;
+
+ {
+ unsigned file = state_machine_regs.file - 1;
+ unsigned dir;
+
+ if (file_table == NULL || n_files == 0)
+ printf (_("\n [Use file table entry %d]\n"), file);
+ /* PR 20439 */
+ else if (file >= n_files)
+ {
+ warn (_("file index %u > number of files %u\n"), file + 1, n_files);
+ printf (_("\n <over large file table index %u>"), file);
+ }
+ else if ((dir = file_table[file].directory_index) == 0)
+ /* If directory index is 0, that means current directory. */
+ printf ("\n./%s:[++]\n", file_table[file].name);
+ else if (directory_table == NULL || n_directories == 0)
+ printf (_("\n [Use file %s in directory table entry %d]\n"),
+ file_table[file].name, dir);
+ /* PR 20439 */
+ else if (dir > n_directories)
+ {
+ warn (_("directory index %u > number of directories %s\n"),
+ dir, dwarf_vmatoa ("u", n_directories));
+ printf (_("\n <over large directory table entry %u>\n"), dir);
+ }
+ else
+ printf ("\n%s/%s:\n",
+ /* The directory index starts counting at 1. */
+ directory_table[dir - 1], file_table[file].name);
+ }
+ break;
+
+ case DW_LNS_set_column:
+ READ_ULEB (uladv, data, end);
+ state_machine_regs.column = uladv;
+ break;
+
+ case DW_LNS_negate_stmt:
+ adv = state_machine_regs.is_stmt;
+ adv = ! adv;
+ state_machine_regs.is_stmt = adv;
+ break;
+
+ case DW_LNS_set_basic_block:
+ state_machine_regs.basic_block = 1;
+ break;
+
+ case DW_LNS_const_add_pc:
+ uladv = ((255 - linfo.li_opcode_base) / linfo.li_line_range);
+ if (linfo.li_max_ops_per_insn == 1)
+ {
+ uladv *= linfo.li_min_insn_length;
+ state_machine_regs.address += uladv;
+ if (uladv)
+ state_machine_regs.view = 0;
+ }
+ else
+ {
+ unsigned addrdelta
+ = ((state_machine_regs.op_index + uladv)
+ / linfo.li_max_ops_per_insn)
+ * linfo.li_min_insn_length;
+ state_machine_regs.address
+ += addrdelta;
+ state_machine_regs.op_index
+ = (state_machine_regs.op_index + uladv)
+ % linfo.li_max_ops_per_insn;
+ if (addrdelta)
+ state_machine_regs.view = 0;
+ }
+ break;
+
+ case DW_LNS_fixed_advance_pc:
+ SAFE_BYTE_GET_AND_INC (uladv, data, 2, end);
+ state_machine_regs.address += uladv;
+ state_machine_regs.op_index = 0;
+ /* Do NOT reset view. */
+ break;
+
+ case DW_LNS_set_prologue_end:
+ break;
+
+ case DW_LNS_set_epilogue_begin:
+ break;
+
+ case DW_LNS_set_isa:
+ READ_ULEB (uladv, data, end);
+ printf (_(" Set ISA to %lu\n"), uladv);
+ break;
+
+ default:
+ printf (_(" Unknown opcode %d with operands: "), op_code);
+
+ if (standard_opcodes != NULL)
+ for (i = standard_opcodes[op_code - 1]; i > 0 ; --i)
+ {
+ dwarf_vma val;
+
+ READ_ULEB (val, data, end);
+ printf ("0x%s%s", dwarf_vmatoa ("x", val),
+ i == 1 ? "" : ", ");
+ }
+ putchar ('\n');
+ break;
+ }
/* Only Special opcodes, DW_LNS_copy and DW_LNE_end_sequence adds a row
to the DWARF address/line matrix. */
unsigned char *start = section->start;
unsigned char *end = start + section->size;
unsigned char *curr = start;
- unsigned int bytes_read;
enum dwarf_macinfo_record_type op;
introduce (section, FALSE);
{
unsigned int filenum;
- lineno = read_uleb128 (curr, & bytes_read, end);
- curr += bytes_read;
- filenum = read_uleb128 (curr, & bytes_read, end);
- curr += bytes_read;
-
+ READ_ULEB (lineno, curr, end);
+ READ_ULEB (filenum, curr, end);
printf (_(" DW_MACINFO_start_file - lineno: %d filenum: %d\n"),
lineno, filenum);
}
break;
case DW_MACINFO_define:
- lineno = read_uleb128 (curr, & bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
string = curr;
curr += strnlen ((char *) string, end - string) + 1;
printf (_(" DW_MACINFO_define - lineno : %d macro : %s\n"),
break;
case DW_MACINFO_undef:
- lineno = read_uleb128 (curr, & bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
string = curr;
curr += strnlen ((char *) string, end - string) + 1;
printf (_(" DW_MACINFO_undef - lineno : %d macro : %s\n"),
{
unsigned int constant;
- constant = read_uleb128 (curr, & bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (constant, curr, end);
string = curr;
curr += strnlen ((char *) string, end - string) + 1;
printf (_(" DW_MACINFO_vendor_ext - constant : %d string : %s\n"),
struct dwarf_section *section = &debug_displays [line].section;
unsigned char *hdrptr, *dirtable, *file_name;
unsigned int offset_size, initial_length_size;
- unsigned int version, opcode_base, bytes_read;
+ unsigned int version, opcode_base;
dwarf_vma length, diridx;
const unsigned char * end;
for (; hdrptr < end && *hdrptr != '\0' && fileidx > 1; fileidx--)
{
hdrptr += strnlen ((char *) hdrptr, end - hdrptr) + 1;
- read_uleb128 (hdrptr, &bytes_read, end);
- hdrptr += bytes_read;
- read_uleb128 (hdrptr, &bytes_read, end);
- hdrptr += bytes_read;
- read_uleb128 (hdrptr, &bytes_read, end);
- hdrptr += bytes_read;
+ SKIP_ULEB (hdrptr, end);
+ SKIP_ULEB (hdrptr, end);
+ SKIP_ULEB (hdrptr, end);
}
if (hdrptr >= end || *hdrptr == '\0')
return NULL;
hdrptr += strnlen ((char *) hdrptr, end - hdrptr) + 1;
if (hdrptr >= end)
return NULL;
- diridx = read_uleb128 (hdrptr, &bytes_read, end);
+ READ_ULEB (diridx, hdrptr, end);
if (diridx == 0)
return file_name;
for (; dirtable < end && *dirtable != '\0' && diridx > 1; diridx--)
unsigned char *end = start + section->size;
unsigned char *curr = start;
unsigned char *extended_op_buf[256];
- unsigned int bytes_read;
load_debug_section_with_follow (str, file);
load_debug_section_with_follow (line, file);
{
SAFE_BYTE_GET_AND_INC (op, curr, 1, end);
extended_ops[op] = curr;
- nargs = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (nargs, curr, end);
if (nargs == 0)
printf (_(" DW_MACRO_%02x has no arguments\n"), op);
else
unsigned int filenum;
unsigned char *file_name = NULL, *dir_name = NULL;
- lineno = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
- filenum = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
+ READ_ULEB (filenum, curr, end);
if ((flags & 2) == 0)
error (_("DW_MACRO_start_file used, but no .debug_line offset provided.\n"));
break;
case DW_MACRO_define:
- lineno = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
string = curr;
curr += strnlen ((char *) string, end - string) + 1;
printf (_(" DW_MACRO_define - lineno : %d macro : %s\n"),
break;
case DW_MACRO_undef:
- lineno = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
string = curr;
curr += strnlen ((char *) string, end - string) + 1;
printf (_(" DW_MACRO_undef - lineno : %d macro : %s\n"),
break;
case DW_MACRO_define_strp:
- lineno = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
string = fetch_indirect_string (offset);
printf (_(" DW_MACRO_define_strp - lineno : %d macro : %s\n"),
break;
case DW_MACRO_undef_strp:
- lineno = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
string = fetch_indirect_string (offset);
printf (_(" DW_MACRO_undef_strp - lineno : %d macro : %s\n"),
break;
case DW_MACRO_define_sup:
- lineno = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
printf (_(" DW_MACRO_define_sup - lineno : %d macro offset : 0x%lx\n"),
lineno, (unsigned long) offset);
break;
case DW_MACRO_undef_sup:
- lineno = read_uleb128 (curr, &bytes_read, end);
- curr += bytes_read;
+ READ_ULEB (lineno, curr, end);
SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
printf (_(" DW_MACRO_undef_sup - lineno : %d macro offset : 0x%lx\n"),
lineno, (unsigned long) offset);
/* Skip over unhandled opcodes. */
dwarf_vma nargs, n;
unsigned char *desc = extended_ops[op];
- nargs = read_uleb128 (desc, &bytes_read, end);
- desc += bytes_read;
+ READ_ULEB (nargs, desc, end);
if (nargs == 0)
{
printf (_(" DW_MACRO_%02x\n"), op);
dwarf_vma off = vstart - section->start;
dwarf_vma vbegin, vend;
- unsigned int bytes_read;
- vbegin = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ READ_ULEB (vbegin, vstart, section_end);
if (vstart == section_end)
- {
- vstart -= bytes_read;
- break;
- }
-
- vend = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ break;
+ READ_ULEB (vend, vstart, section_end);
printf (" %8.8lx ", (unsigned long) off);
print_dwarf_view (vbegin, pointer_size, 1);
if (vstart)
{
- unsigned int bytes_read;
-
off = offset + (vstart - *start_ptr);
- vbegin = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ READ_ULEB (vbegin, vstart, section_end);
print_dwarf_view (vbegin, pointer_size, 1);
- vend = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ READ_ULEB (vend, vstart, section_end);
print_dwarf_view (vend, pointer_size, 1);
printf (_("views at %8.8lx for:\n %*s "),
unsigned int pointer_size;
unsigned int offset_size;
int dwarf_version;
- unsigned int bytes_read;
/* Initialize it due to a false compiler warning. */
dwarf_vma begin = -1, vbegin = -1;
{
off = offset + (vstart - *start_ptr);
- vbegin = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ READ_ULEB (vbegin, vstart, section_end);
print_dwarf_view (vbegin, pointer_size, 1);
- vend = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ READ_ULEB (vend, vstart, section_end);
print_dwarf_view (vend, pointer_size, 1);
printf (_("views at %8.8lx for:\n %*s "),
printf (_("<End of list>\n"));
break;
case DW_LLE_offset_pair:
- begin = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
- end = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (begin, start, section_end);
+ READ_ULEB (end, start, section_end);
break;
case DW_LLE_base_address:
SAFE_BYTE_GET_AND_INC (base_address, start, pointer_size,
case DW_LLE_view_pair:
if (vstart)
printf (_("View pair entry in loclist with locviews attribute\n"));
- vbegin = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (vbegin, start, section_end);
print_dwarf_view (vbegin, pointer_size, 1);
- vend = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (vend, start, section_end);
print_dwarf_view (vend, pointer_size, 1);
printf (_("views for:\n"));
break;
}
- length = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (length, start, section_end);
print_dwarf_vma (begin + base_address, pointer_size);
print_dwarf_vma (end + base_address, pointer_size);
unsigned short length;
int need_frame_base;
unsigned int idx;
- unsigned int bytes_read;
if (debug_info_entry >= num_debug_info_entries)
{
dwarf_vma view;
dwarf_vma off = offset + (vstart - *start_ptr);
- view = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ READ_ULEB (view, vstart, section_end);
print_dwarf_view (view, 8, 1);
- view = read_uleb128 (vstart, &bytes_read, section_end);
- vstart += bytes_read;
+ READ_ULEB (view, vstart, section_end);
print_dwarf_view (view, 8, 1);
printf (_("views at %8.8lx for:\n %*s "),
printf (_("<End of list>\n"));
return;
case 1: /* A base-address entry. */
- idx = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (idx, start, section_end);
print_addr_index (idx, 8);
printf ("%*s", 9 + (vstart ? 2 * 6 : 0), "");
printf (_("(base address selection entry)\n"));
continue;
case 2: /* A start/end entry. */
- idx = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (idx, start, section_end);
print_addr_index (idx, 8);
- idx = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (idx, start, section_end);
print_addr_index (idx, 8);
break;
case 3: /* A start/length entry. */
- idx = read_uleb128 (start, &bytes_read, section_end);
- start += bytes_read;
+ READ_ULEB (idx, start, section_end);
print_addr_index (idx, 8);
SAFE_BYTE_GET_AND_INC (idx, start, 4, section_end);
printf ("%08x ", idx);
enum dwarf_range_list_entry rlet;
/* Initialize it due to a false compiler warning. */
dwarf_vma begin = -1, length, end = -1;
- unsigned int bytes_read;
if (start + 1 > finish)
{
break;
case DW_RLE_start_length:
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, finish);
- length = read_uleb128 (start, &bytes_read, finish);
- start += bytes_read;
+ READ_ULEB (length, start, finish);
end = begin + length;
break;
case DW_RLE_offset_pair:
- begin = read_uleb128 (start, &bytes_read, finish);
- start += bytes_read;
- end = read_uleb128 (start, &bytes_read, finish);
- start += bytes_read;
+ READ_ULEB (begin, start, finish);
+ READ_ULEB (end, start, finish);
break;
case DW_RLE_start_end:
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, finish);
{
int version;
Frame_Chunk *fc;
- unsigned int length_return;
unsigned char *augmentation_data = NULL;
bfd_size_type augmentation_data_len = 0;
fc->segment_size = 0;
}
- READ_ULEB (fc->code_factor);
- READ_SLEB (fc->data_factor);
+ READ_ULEB (fc->code_factor, start, end);
+ READ_SLEB (fc->data_factor, start, end);
if (version == 1)
{
}
else
{
- READ_ULEB (fc->ra);
+ READ_ULEB (fc->ra, start, end);
}
if (fc->augmentation[0] == 'z')
{
- READ_ULEB (augmentation_data_len);
+ READ_ULEB (augmentation_data_len, start, end);
augmentation_data = start;
/* PR 17512: file: 11042-2589-0.004. */
if (augmentation_data_len > (bfd_size_type) (end - start))
Frame_Chunk *remembered_state = NULL;
Frame_Chunk *rs;
bfd_boolean is_eh = strcmp (section->name, ".eh_frame") == 0;
- unsigned int length_return;
unsigned int max_regs = 0;
const char *bad_reg = _("bad register: ");
unsigned int saved_eh_addr_size = eh_addr_size;
if (cie->augmentation[0] == 'z')
{
- READ_ULEB (augmentation_data_len);
+ READ_ULEB (augmentation_data_len, start, end);
augmentation_data = start;
/* PR 17512 file: 722-8446-0.004 and PR 22386. */
if (augmentation_data_len > (bfd_size_type) (end - start))
case DW_CFA_advance_loc:
break;
case DW_CFA_offset:
- SKIP_ULEB ();
+ SKIP_ULEB (start, end);
if (frame_need_space (fc, opa) >= 0)
fc->col_type[opa] = DW_CFA_undefined;
break;
break;
case DW_CFA_offset_extended:
case DW_CFA_val_offset:
- READ_ULEB (reg);
- SKIP_ULEB ();
+ READ_ULEB (reg, start, end);
+ SKIP_ULEB (start, end);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_restore_extended:
- READ_ULEB (reg);
+ READ_ULEB (reg, start, end);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_undefined:
- READ_ULEB (reg);
+ READ_ULEB (reg, start, end);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_same_value:
- READ_ULEB (reg);
+ READ_ULEB (reg, start, end);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_register:
- READ_ULEB (reg);
- SKIP_ULEB ();
+ READ_ULEB (reg, start, end);
+ SKIP_ULEB (start, end);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_def_cfa:
- SKIP_ULEB ();
- SKIP_ULEB ();
+ SKIP_ULEB (start, end);
+ SKIP_ULEB (start, end);
break;
case DW_CFA_def_cfa_register:
- SKIP_ULEB ();
+ SKIP_ULEB (start, end);
break;
case DW_CFA_def_cfa_offset:
- SKIP_ULEB ();
+ SKIP_ULEB (start, end);
break;
case DW_CFA_def_cfa_expression:
- READ_ULEB (temp);
+ READ_ULEB (temp, start, end);
new_start = start + temp;
if (new_start < start)
{
break;
case DW_CFA_expression:
case DW_CFA_val_expression:
- READ_ULEB (reg);
- READ_ULEB (temp);
+ READ_ULEB (reg, start, end);
+ READ_ULEB (temp, start, end);
new_start = start + temp;
if (new_start < start)
{
break;
case DW_CFA_offset_extended_sf:
case DW_CFA_val_offset_sf:
- READ_ULEB (reg);
- SKIP_SLEB ();
+ READ_ULEB (reg, start, end);
+ SKIP_SLEB (start, end);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_def_cfa_sf:
- SKIP_ULEB ();
- SKIP_SLEB ();
+ SKIP_ULEB (start, end);
+ SKIP_SLEB (start, end);
break;
case DW_CFA_def_cfa_offset_sf:
- SKIP_SLEB ();
+ SKIP_SLEB (start, end);
break;
case DW_CFA_MIPS_advance_loc8:
start += 8;
break;
case DW_CFA_GNU_args_size:
- SKIP_ULEB ();
+ SKIP_ULEB (start, end);
break;
case DW_CFA_GNU_negative_offset_extended:
- READ_ULEB (reg);
- SKIP_ULEB ();
+ READ_ULEB (reg, start, end);
+ SKIP_ULEB (start, end);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
break;
case DW_CFA_offset:
- READ_ULEB (roffs);
+ READ_ULEB (roffs, start, end);
if (opa >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_offset_extended:
- READ_ULEB (reg);
- READ_ULEB (roffs);
+ READ_ULEB (reg, start, end);
+ READ_ULEB (roffs, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_val_offset:
- READ_ULEB (reg);
- READ_ULEB (roffs);
+ READ_ULEB (reg, start, end);
+ READ_ULEB (roffs, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_restore_extended:
- READ_ULEB (reg);
+ READ_ULEB (reg, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_undefined:
- READ_ULEB (reg);
+ READ_ULEB (reg, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_same_value:
- READ_ULEB (reg);
+ READ_ULEB (reg, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_register:
- READ_ULEB (reg);
- READ_ULEB (roffs);
+ READ_ULEB (reg, start, end);
+ READ_ULEB (roffs, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_def_cfa:
- READ_ULEB (fc->cfa_reg);
- READ_ULEB (fc->cfa_offset);
+ READ_ULEB (fc->cfa_reg, start, end);
+ READ_ULEB (fc->cfa_offset, start, end);
fc->cfa_exp = 0;
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa: %s ofs %d\n",
break;
case DW_CFA_def_cfa_register:
- READ_ULEB (fc->cfa_reg);
+ READ_ULEB (fc->cfa_reg, start, end);
fc->cfa_exp = 0;
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa_register: %s\n",
break;
case DW_CFA_def_cfa_offset:
- READ_ULEB (fc->cfa_offset);
+ READ_ULEB (fc->cfa_offset, start, end);
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa_offset: %d\n", (int) fc->cfa_offset);
break;
break;
case DW_CFA_def_cfa_expression:
- READ_ULEB (ul);
+ READ_ULEB (ul, start, end);
if (start >= block_end || ul > (unsigned long) (block_end - start))
{
printf (_(" DW_CFA_def_cfa_expression: <corrupt len %lu>\n"), ul);
break;
case DW_CFA_expression:
- READ_ULEB (reg);
- READ_ULEB (ul);
+ READ_ULEB (reg, start, end);
+ READ_ULEB (ul, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
/* PR 17512: file: 069-133014-0.006. */
break;
case DW_CFA_val_expression:
- READ_ULEB (reg);
- READ_ULEB (ul);
+ READ_ULEB (reg, start, end);
+ READ_ULEB (ul, start, end);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
tmp = start + ul;
break;
case DW_CFA_offset_extended_sf:
- READ_ULEB (reg);
- READ_SLEB (l);
+ READ_ULEB (reg, start, end);
+ READ_SLEB (l, start, end);
if (frame_need_space (fc, reg) < 0)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_val_offset_sf:
- READ_ULEB (reg);
- READ_SLEB (l);
+ READ_ULEB (reg, start, end);
+ READ_SLEB (l, start, end);
if (frame_need_space (fc, reg) < 0)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
break;
case DW_CFA_def_cfa_sf:
- READ_ULEB (fc->cfa_reg);
- READ_ULEB (fc->cfa_offset);
+ READ_ULEB (fc->cfa_reg, start, end);
+ READ_ULEB (fc->cfa_offset, start, end);
fc->cfa_offset = fc->cfa_offset * fc->data_factor;
fc->cfa_exp = 0;
if (! do_debug_frames_interp)
break;
case DW_CFA_def_cfa_offset_sf:
- READ_ULEB (fc->cfa_offset);
+ READ_ULEB (fc->cfa_offset, start, end);
fc->cfa_offset *= fc->data_factor;
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa_offset_sf: %d\n", (int) fc->cfa_offset);
break;
case DW_CFA_GNU_args_size:
- READ_ULEB (ul);
+ READ_ULEB (ul, start, end);
if (! do_debug_frames_interp)
printf (" DW_CFA_GNU_args_size: %ld\n", ul);
break;
case DW_CFA_GNU_negative_offset_extended:
- READ_ULEB (reg);
- READ_SLEB (l);
+ READ_ULEB (reg, start, end);
+ READ_SLEB (l, start, end);
l = - l;
if (frame_need_space (fc, reg) < 0)
reg_prefix = bad_reg;
unsigned char *abbrevptr = abbrev_table;
for (;;)
{
- unsigned int bytes_read;
- const dwarf_vma abbrev_tag = read_uleb128 (abbrevptr, &bytes_read,
- abbrev_table_end);
- abbrevptr += bytes_read;
+ dwarf_vma abbrev_tag;
+
+ READ_ULEB (abbrev_tag, abbrevptr, abbrev_table_end);
if (abbrev_tag == 0)
break;
if (abbrev_lookup_used == abbrev_lookup_allocated)
entry->abbrev_lookup_ptr = abbrevptr;
/* Skip DWARF tag. */
- read_uleb128 (abbrevptr, &bytes_read, abbrev_table_end);
- abbrevptr += bytes_read;
+ SKIP_ULEB (abbrevptr, abbrev_table_end);
for (;;)
{
- const dwarf_vma xindex = read_uleb128 (abbrevptr,
- &bytes_read,
- abbrev_table_end);
- abbrevptr += bytes_read;
- const dwarf_vma form = read_uleb128 (abbrevptr, &bytes_read,
- abbrev_table_end);
- abbrevptr += bytes_read;
+ dwarf_vma xindex, form;
+
+ READ_ULEB (xindex, abbrevptr, abbrev_table_end);
+ READ_ULEB (form, abbrevptr, abbrev_table_end);
if (xindex == 0 && form == 0)
break;
}
dwarf_vma second_abbrev_tag = -1;
for (;;)
{
- unsigned int bytes_read;
- const dwarf_vma abbrev_tag = read_uleb128 (entryptr, &bytes_read,
- unit_end);
- entryptr += bytes_read;
+ dwarf_vma abbrev_tag;
+ dwarf_vma dwarf_tag;
+ const struct abbrev_lookup_entry *entry;
+
+ READ_ULEB (abbrev_tag, entryptr, unit_end);
if (tagno == -1)
{
second_abbrev_tag = abbrev_tag;
(tagno == 0 && second_abbrev_tag == 0 ? " " : "\n\t"),
(unsigned long) abbrev_tag);
- const struct abbrev_lookup_entry *entry;
for (entry = abbrev_lookup;
entry < abbrev_lookup + abbrev_lookup_used;
entry++)
break;
}
abbrevptr = entry->abbrev_lookup_ptr;
- const dwarf_vma dwarf_tag = read_uleb128 (abbrevptr, &bytes_read,
- abbrev_table_end);
- abbrevptr += bytes_read;
+ READ_ULEB (dwarf_tag, abbrevptr, abbrev_table_end);
if (tagno >= 0)
printf (" %s", get_TAG_name (dwarf_tag));
for (;;)
{
- const dwarf_vma xindex = read_uleb128 (abbrevptr,
- &bytes_read,
- abbrev_table_end);
- abbrevptr += bytes_read;
- const dwarf_vma form = read_uleb128 (abbrevptr, &bytes_read,
- abbrev_table_end);
- abbrevptr += bytes_read;
+ dwarf_vma xindex, form;
+
+ READ_ULEB (xindex, abbrevptr, abbrev_table_end);
+ READ_ULEB (form, abbrevptr, abbrev_table_end);
if (xindex == 0 && form == 0)
break;
return find_section (filedata, name);
}
-/* Read an unsigned LEB128 encoded value from DATA.
- Set *LENGTH_RETURN to the number of bytes read. */
-
-static inline unsigned long
-read_uleb128 (unsigned char * data,
- unsigned int * length_return,
- const unsigned char * const end)
-{
- return read_leb128 (data, length_return, FALSE, end);
-}
-
/* Return TRUE if the current file is for IA-64 machine and OpenVMS ABI.
This OS has so many departures from the ELF standard that we test it at
many places. */
}
else
{
- offset = read_uleb128 (buf, &len, buf + i + 1);
+ offset = read_leb128 (buf, buf + i + 1, FALSE, &len, NULL);
assert (len == i + 1);
offset = offset * 4 + 0x204;
printf ("vsp = vsp + %ld", offset);
return FALSE;
}
- offset = read_uleb128 (buf, &len, buf + i + 1);
+ offset = read_leb128 (buf, buf + i + 1, FALSE, &len, NULL);
assert (len == i + 1);
offset = offset * 8 + 0x408;
printf (_("sp = sp + %ld"), offset);
}
else
{
- unsigned int len;
-
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf ("%ld (0x%lx)\n", val, val);
}
const unsigned char * const end)
{
unsigned int tag;
- unsigned int len;
unsigned int val;
- tag = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (tag, p, end);
switch (tag)
{
case Tag_ARC_PCS_config:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_PCS_config: ");
switch (val)
{
break;
case Tag_ARC_CPU_base:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_CPU_base: ");
switch (val)
{
break;
case Tag_ARC_CPU_variation:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_CPU_variation: ");
switch (val)
{
break;
case Tag_ARC_ABI_rf16:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ABI_rf16: %s\n", val ? _("yes") : _("no"));
break;
case Tag_ARC_ABI_osver:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ABI_osver: v%d\n", val);
break;
case Tag_ARC_ABI_pic:
case Tag_ARC_ABI_sda:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (tag == Tag_ARC_ABI_sda ? " Tag_ARC_ABI_sda: "
: " Tag_ARC_ABI_pic: ");
switch (val)
break;
case Tag_ARC_ABI_tls:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ABI_tls: %s\n", val ? "r25": "none");
break;
case Tag_ARC_ABI_enumsize:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ABI_enumsize: %s\n", val ? _("default") :
_("smallest"));
break;
case Tag_ARC_ABI_exceptions:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ABI_exceptions: %s\n", val ? _("OPTFP")
: _("default"));
break;
case Tag_ARC_ABI_double_size:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ABI_double_size: %d\n", val);
break;
break;
case Tag_ARC_ISA_mpy_option:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ISA_mpy_option: %d\n", val);
break;
case Tag_ARC_ATR_version:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ARC_ATR_version: %d\n", val);
break;
const unsigned char * const end)
{
unsigned int tag;
- unsigned int len;
unsigned int val;
arm_attr_public_tag * attr;
unsigned i;
unsigned int type;
- tag = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (tag, p, end);
attr = NULL;
for (i = 0; i < ARRAY_SIZE (arm_attr_public_tags); i++)
{
switch (tag)
{
case 7: /* Tag_CPU_arch_profile. */
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
switch (val)
{
case 0: printf (_("None\n")); break;
break;
case 24: /* Tag_align_needed. */
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
switch (val)
{
case 0: printf (_("None\n")); break;
break;
case 25: /* Tag_align_preserved. */
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
switch (val)
{
case 0: printf (_("None\n")); break;
case 32: /* Tag_compatibility. */
{
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (_("flag = %d, vendor = "), val);
if (p < end - 1)
{
break;
case 65: /* Tag_also_compatible_with. */
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
if (val == 6 /* Tag_CPU_arch. */)
{
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
if ((unsigned int) val >= ARRAY_SIZE (arm_attr_tag_CPU_arch))
printf ("??? (%d)\n", val);
else
default:
assert (attr->type & 0x80);
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
type = attr->type & 0x7f;
if (val >= type)
printf ("??? (%d)\n", val);
unsigned char * (* display_proc_gnu_attribute) (unsigned char *, unsigned int, const unsigned char * const),
const unsigned char * const end)
{
- int tag;
- unsigned int len;
+ unsigned int tag;
unsigned int val;
- tag = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (tag, p, end);
/* Tag_compatibility is the only generic GNU attribute defined at
present. */
if (tag == 32)
{
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (_("flag = %d, vendor = "), val);
if (p == end)
unsigned int tag,
const unsigned char * const end)
{
- unsigned int len;
unsigned int val;
if (tag == Tag_GNU_Power_ABI_FP)
{
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_GNU_Power_ABI_FP: ");
- if (len == 0)
+ if (p == end)
{
printf (_("<corrupt>\n"));
return p;
}
+ READ_ULEB (val, p, end);
if (val > 15)
printf ("(%#x), ", val);
if (tag == Tag_GNU_Power_ABI_Vector)
{
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_GNU_Power_ABI_Vector: ");
- if (len == 0)
+ if (p == end)
{
printf (_("<corrupt>\n"));
return p;
}
+ READ_ULEB (val, p, end);
if (val > 3)
printf ("(%#x), ", val);
if (tag == Tag_GNU_Power_ABI_Struct_Return)
{
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_GNU_Power_ABI_Struct_Return: ");
- if (len == 0)
+ if (p == end)
{
printf (_("<corrupt>\n"));
return p;
}
+ READ_ULEB (val, p, end);
if (val > 2)
printf ("(%#x), ", val);
unsigned int tag,
const unsigned char * const end)
{
- unsigned int len;
- int val;
+ unsigned int val;
if (tag == Tag_GNU_S390_ABI_Vector)
{
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_GNU_S390_ABI_Vector: ");
+ READ_ULEB (val, p, end);
switch (val)
{
unsigned int tag,
const unsigned char * const end)
{
- unsigned int len;
- int val;
+ unsigned int val;
if (tag == Tag_GNU_Sparc_HWCAPS)
{
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_GNU_Sparc_HWCAPS: ");
display_sparc_hwcaps (val);
return p;
}
if (tag == Tag_GNU_Sparc_HWCAPS2)
{
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_GNU_Sparc_HWCAPS2: ");
display_sparc_hwcaps2 (val);
return p;
{
if (tag == Tag_GNU_MIPS_ABI_FP)
{
- unsigned int len;
unsigned int val;
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_GNU_MIPS_ABI_FP: ");
-
+ READ_ULEB (val, p, end);
print_mips_fp_abi_value (val);
-
return p;
}
if (tag == Tag_GNU_MIPS_ABI_MSA)
{
- unsigned int len;
unsigned int val;
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_GNU_MIPS_ABI_MSA: ");
+ READ_ULEB (val, p, end);
switch (val)
{
const unsigned char * const end)
{
unsigned int tag;
- unsigned int len;
- int val;
+ unsigned int val;
- tag = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (tag, p, end);
switch (tag)
{
case Tag_ISA:
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_ISA: ");
+ READ_ULEB (val, p, end);
switch (val)
{
return p;
case Tag_ABI_wchar_t:
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_ABI_wchar_t: ");
+ READ_ULEB (val, p, end);
switch (val)
{
case 0:
return p;
case Tag_ABI_stack_align_needed:
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_ABI_stack_align_needed: ");
+ READ_ULEB (val, p, end);
switch (val)
{
case 0:
return p;
case Tag_ABI_stack_align_preserved:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ABI_stack_align_preserved: ");
switch (val)
{
return p;
case Tag_ABI_DSBT:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ABI_DSBT: ");
switch (val)
{
return p;
case Tag_ABI_PID:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ABI_PID: ");
switch (val)
{
return p;
case Tag_ABI_PIC:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ABI_PIC: ");
switch (val)
{
return p;
case Tag_ABI_array_object_alignment:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ABI_array_object_alignment: ");
switch (val)
{
return p;
case Tag_ABI_array_object_align_expected:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ABI_array_object_align_expected: ");
switch (val)
{
case Tag_ABI_compatibility:
{
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf (" Tag_ABI_compatibility: ");
printf (_("flag = %d, vendor = "), val);
if (p < end - 1)
display_msp430x_attribute (unsigned char * p,
const unsigned char * const end)
{
- unsigned int len;
unsigned int val;
unsigned int tag;
- tag = read_uleb128 (p, & len, end);
- p += len;
+ READ_ULEB (tag, p, end);
switch (tag)
{
case OFBA_MSPABI_Tag_ISA:
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_ISA: ");
+ READ_ULEB (val, p, end);
switch (val)
{
case 0: printf (_("None\n")); break;
break;
case OFBA_MSPABI_Tag_Code_Model:
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_Code_Model: ");
+ READ_ULEB (val, p, end);
switch (val)
{
case 0: printf (_("None\n")); break;
break;
case OFBA_MSPABI_Tag_Data_Model:
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_Data_Model: ");
+ READ_ULEB (val, p, end);
switch (val)
{
case 0: printf (_("None\n")); break;
}
else
{
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
printf ("%d (0x%x)\n", val, val);
}
break;
{
if (tag == Tag_GNU_MSP430_Data_Region)
{
- unsigned int len;
- int val;
+ unsigned int val;
- val = read_uleb128 (p, &len, end);
- p += len;
printf (" Tag_GNU_MSP430_Data_Region: ");
+ READ_ULEB (val, p, end);
switch (val)
{
printf (_("Lower Region Only\n"));
break;
default:
- printf ("??? (%d)\n", val);
+ printf ("??? (%u)\n", val);
}
return p;
}
struct riscv_attr_tag_t {
const char *name;
- int tag;
+ unsigned int tag;
};
static struct riscv_attr_tag_t riscv_attr_tag[] =
display_riscv_attribute (unsigned char *p,
const unsigned char * const end)
{
- unsigned int len;
- int val;
- int tag;
+ unsigned int val;
+ unsigned int tag;
struct riscv_attr_tag_t *attr = NULL;
unsigned i;
- tag = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (tag, p, end);
/* Find the name of attribute. */
for (i = 0; i < ARRAY_SIZE (riscv_attr_tag); i++)
case Tag_RISCV_priv_spec:
case Tag_RISCV_priv_spec_minor:
case Tag_RISCV_priv_spec_revision:
- val = read_uleb128 (p, &len, end);
- p += len;
- printf (_("%d\n"), val);
+ READ_ULEB (val, p, end);
+ printf (_("%u\n"), val);
break;
case Tag_RISCV_unaligned_access:
- val = read_uleb128 (p, &len, end);
- p += len;
+ READ_ULEB (val, p, end);
switch (val)
{
case 0:
}
break;
case Tag_RISCV_stack_align:
- val = read_uleb128 (p, &len, end);
- p += len;
- printf (_("%d-bytes\n"), val);
+ READ_ULEB (val, p, end);
+ printf (_("%u-bytes\n"), val);
break;
case Tag_RISCV_arch:
p = display_tag_value (-1, p, end);
while (attr_len > 0 && p < contents + sect->sh_size)
{
int tag;
- int val;
+ unsigned int val;
bfd_vma size;
unsigned char * end;
do_numlist:
for (;;)
{
- unsigned int j;
-
- val = read_uleb128 (p, &j, end);
- p += j;
+ READ_ULEB (val, p, end);
if (val == 0)
break;
printf (" %d", val);