{
dwo_type type;
const char * value;
- dwarf_vma cu_offset;
+ uint64_t cu_offset;
struct dwo_info * next;
} dwo_info;
int dwarf_check = 0;
-/* Convenient constant, to avoid having to cast -1 to dwarf_vma when
- testing whether e.g. a locview list is present. */
-static const dwarf_vma vm1 = -1;
-
/* Collection of CU/TU section sets from .debug_cu_index and .debug_tu_index
sections. For version 1 package files, each set is stored in SHNDX_POOL
as a zero-terminated list of section indexes comprising one set of debug
struct cu_tu_set
{
- uint64_t signature;
- dwarf_vma section_offsets[DW_SECT_MAX];
- size_t section_sizes[DW_SECT_MAX];
+ uint64_t signature;
+ uint64_t section_offsets[DW_SECT_MAX];
+ size_t section_sizes[DW_SECT_MAX];
};
static int cu_count = 0;
}
}
-static dwarf_vma
+static uint64_t
get_encoded_value (unsigned char **pdata,
int encoding,
struct dwarf_section *section,
{
unsigned char * data = * pdata;
unsigned int size = size_of_encoded_value (encoding);
- dwarf_vma val;
+ uint64_t val;
if (data >= end || size > (size_t) (end - data))
{
return val;
}
-#if SIZEOF_LONG_LONG > SIZEOF_LONG
-# ifndef __MINGW32__
-# define DWARF_VMA_FMT "ll"
-# define DWARF_VMA_FMT_LONG "%16.16llx"
-# else
-# define DWARF_VMA_FMT "I64"
-# define DWARF_VMA_FMT_LONG "%016I64x"
-# endif
-#else
-# define DWARF_VMA_FMT "l"
-# define DWARF_VMA_FMT_LONG "%16.16lx"
-#endif
-
-/* Convert a dwarf vma value into a string. Returns a pointer to a static
- buffer containing the converted VALUE. The value is converted according
- to the printf formating character FMTCH. If NUM_BYTES is non-zero then
- it specifies the maximum number of bytes to be displayed in the converted
- value and FMTCH is ignored - hex is always used. */
+/* Print a uint64_t value (typically an address, offset or length) in
+ hexadecimal format, followed by a space. The precision displayed is
+ determined by the NUM_BYTES parameter. */
-static const char *
-dwarf_vmatoa_1 (const char *fmtch, dwarf_vma value, unsigned num_bytes)
+static void
+print_hex (uint64_t value, unsigned num_bytes)
{
- /* As dwarf_vmatoa is used more then once in a printf call
- for output, we are cycling through a fixed array of pointers
- for return address. */
- static int buf_pos = 0;
- static struct dwarf_vmatoa_buf
- {
- char place[64];
- } buf[16];
- char *ret;
-
- ret = buf[buf_pos++].place;
- buf_pos %= ARRAY_SIZE (buf);
-
- if (num_bytes)
- {
- /* Printf does not have a way of specifying a maximum field width for an
- integer value, so we print the full value into a buffer and then select
- the precision we need. */
- snprintf (ret, sizeof (buf[0].place), DWARF_VMA_FMT_LONG, value);
- if (num_bytes > 8)
- num_bytes = 8;
- return ret + (16 - 2 * num_bytes);
- }
- else
- {
- char fmt[32];
+ if (num_bytes == 0)
+ num_bytes = 2;
- if (fmtch)
- sprintf (fmt, "%%%s%s", DWARF_VMA_FMT, fmtch);
- else
- sprintf (fmt, "%%%s", DWARF_VMA_FMT);
- snprintf (ret, sizeof (buf[0].place), fmt, value);
- return ret;
- }
-}
-
-static inline const char *
-dwarf_vmatoa (const char * fmtch, dwarf_vma value)
-{
- return dwarf_vmatoa_1 (fmtch, value, 0);
+ printf ("%0*" PRIx64 " ", num_bytes * 2,
+ value & ~(~(uint64_t) 0 << num_bytes * 4 << num_bytes * 4));
}
-/* Print a dwarf_vma value (typically an address, offset or length) in
- hexadecimal format, followed by a space. The length of the VALUE (and
- hence the precision displayed) is determined by the NUM_BYTES parameter. */
+/* Like print_hex, but no trailing space. */
static void
-print_dwarf_vma (dwarf_vma value, unsigned num_bytes)
+print_hex_ns (uint64_t value, unsigned num_bytes)
{
- printf ("%s ", dwarf_vmatoa_1 (NULL, value, num_bytes));
+ if (num_bytes == 0)
+ num_bytes = 2;
+
+ printf ("%0*" PRIx64, num_bytes * 2,
+ value & ~(~(uint64_t) 0 << num_bytes * 4 << num_bytes * 4));
}
-/* Print a view number in hexadecimal value, with the same width
- print_dwarf_vma would have printed it with the same num_bytes.
- Print blanks for zero view, unless force is nonzero. */
+/* Print a view number in hexadecimal value, with the same width as
+ print_hex would have printed it. */
static void
-print_dwarf_view (dwarf_vma value, unsigned num_bytes, int force)
+print_view (uint64_t value, unsigned num_bytes)
{
- int len;
- if (!num_bytes)
- len = 4;
- else
- len = num_bytes * 2;
+ if (num_bytes == 0)
+ num_bytes = 2;
- assert (value == (unsigned long) value);
- if (value || force)
- printf ("v%0*lx ", len - 1, (unsigned long) value);
- else
- printf ("%*s", len + 1, "");
+ printf ("v%0*" PRIx64 " ", num_bytes * 2 - 1,
+ value & ~(~(uint64_t) 0 << num_bytes * 4 << num_bytes * 4));
}
/* Read in a LEB128 encoded value starting at address DATA.
If LENGTH_RETURN is not NULL, return in it the number of bytes read.
If STATUS_RETURN is 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.
+ overflows a uint64_t.
No bytes will be read at address END or beyond. */
-dwarf_vma
+uint64_t
read_leb128 (unsigned char *data,
const unsigned char *const end,
bool sign,
unsigned int *length_return,
int *status_return)
{
- dwarf_vma result = 0;
+ uint64_t result = 0;
unsigned int num_read = 0;
unsigned int shift = 0;
int status = 1;
if (shift < CHAR_BIT * sizeof (result))
{
- result |= ((dwarf_vma) (byte & 0x7f)) << shift;
+ result |= ((uint64_t) (byte & 0x7f)) << shift;
/* These bits overflowed. */
lost = byte ^ (result >> shift);
/* And this is the mask of possible overflow bits. */
- mask = 0x7f ^ ((dwarf_vma) 0x7f << shift >> shift);
+ mask = 0x7f ^ ((uint64_t) 0x7f << shift >> shift);
shift += 7;
}
else
lost = byte;
mask = 0x7f;
}
- if ((lost & mask) != (sign && (dwarf_signed_vma) result < 0 ? mask : 0))
+ if ((lost & mask) != (sign && (int64_t) result < 0 ? mask : 0))
status |= 2;
if ((byte & 0x80) == 0)
{
status &= ~1;
if (sign && shift < CHAR_BIT * sizeof (result) && (byte & 0x40))
- result |= -((dwarf_vma) 1 << shift);
+ result |= -((uint64_t) 1 << shift);
break;
}
}
typedef struct State_Machine_Registers
{
- dwarf_vma address;
+ uint64_t address;
unsigned int view;
unsigned int file;
unsigned int line;
size_t len, header_len;
unsigned char *name;
unsigned char *orig_data = data;
- dwarf_vma adr, val;
+ uint64_t adr, val;
READ_ULEB (len, data, end);
header_len = data - orig_data;
/* PR 17512: file: 002-100480-0.004. */
if (len - 1 > 8)
{
- warn (_("Length (%lu) of DW_LNE_set_address op is too long\n"),
- (unsigned long) len - 1);
+ warn (_("Length (%zu) of DW_LNE_set_address op is too long\n"),
+ len - 1);
adr = 0;
}
else
SAFE_BYTE_GET (adr, data, len - 1, end);
- printf (_("set Address to 0x%s\n"), dwarf_vmatoa ("x", adr));
+ printf (_("set Address to 0x%" PRIx64 "\n"), adr);
state_machine_regs.address = adr;
state_machine_regs.view = 0;
state_machine_regs.op_index = 0;
if (data < end)
data++;
READ_ULEB (val, data, end);
- printf ("%s\t", dwarf_vmatoa ("u", val));
+ printf ("%" PRIu64 "\t", val);
READ_ULEB (val, data, end);
- printf ("%s\t", dwarf_vmatoa ("u", val));
+ printf ("%" PRIu64 "\t", val);
READ_ULEB (val, data, end);
- printf ("%s\t", dwarf_vmatoa ("u", val));
+ printf ("%" PRIu64 "\t", val);
printf ("%.*s\n\n", (int) l, name);
}
case DW_LNE_set_discriminator:
READ_ULEB (val, data, end);
- printf (_("set Discriminator to %s\n"), dwarf_vmatoa ("u", val));
+ printf (_("set Discriminator to %" PRIu64 "\n"), val);
break;
/* HP extensions. */
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", val));
+ printf (" DW_LNE_HP_SFC_set_listing_line (%" PRIu64 ")\n",
+ val);
break;
case DW_LNE_HP_SFC_associate:
printf (" DW_LNE_HP_SFC_associate ");
READ_ULEB (val, data, edata);
- printf ("(%s", dwarf_vmatoa ("u", val));
+ printf ("(%" PRIu64 , val);
READ_ULEB (val, data, edata);
- printf (",%s", dwarf_vmatoa ("u", val));
+ printf (",%" PRIu64, val);
READ_ULEB (val, data, edata);
- printf (",%s)\n", dwarf_vmatoa ("u", val));
+ printf (",%" PRIu64 ")\n", val);
break;
default:
printf (_(" UNKNOWN DW_LNE_HP_SFC opcode (%u)\n"), opc);
}
static const unsigned char *
-fetch_indirect_string (dwarf_vma offset)
+fetch_indirect_string (uint64_t offset)
{
struct dwarf_section *section = &debug_displays [str].section;
const unsigned char * ret;
if (offset >= section->size)
{
- warn (_("DW_FORM_strp offset too big: 0x%s\n"),
- dwarf_vmatoa ("x", offset));
+ warn (_("DW_FORM_strp offset too big: %#" PRIx64 "\n"), offset);
return (const unsigned char *) _("<offset is too big>");
}
}
static const unsigned char *
-fetch_indirect_line_string (dwarf_vma offset)
+fetch_indirect_line_string (uint64_t offset)
{
struct dwarf_section *section = &debug_displays [line_str].section;
const unsigned char * ret;
if (offset >= section->size)
{
- warn (_("DW_FORM_line_strp offset too big: 0x%s\n"),
- dwarf_vmatoa ("x", offset));
+ warn (_("DW_FORM_line_strp offset too big: %#" PRIx64 "\n"), offset);
return (const unsigned char *) _("<offset is too big>");
}
}
static const char *
-fetch_indexed_string (dwarf_vma idx,
- struct cu_tu_set * this_set,
- dwarf_vma offset_size,
- bool dwo,
- dwarf_vma str_offsets_base)
+fetch_indexed_string (uint64_t idx,
+ struct cu_tu_set *this_set,
+ uint64_t offset_size,
+ bool dwo,
+ uint64_t str_offsets_base)
{
enum dwarf_section_display_enum str_sec_idx = dwo ? str_dwo : str;
enum dwarf_section_display_enum idx_sec_idx = dwo ? str_index_dwo : str_index;
struct dwarf_section *index_section = &debug_displays [idx_sec_idx].section;
struct dwarf_section *str_section = &debug_displays [str_sec_idx].section;
- dwarf_vma index_offset;
- dwarf_vma str_offset;
+ uint64_t index_offset;
+ uint64_t str_offset;
const char * ret;
if (index_section->start == NULL)
if (index_offset + offset_size > index_section->size)
{
- warn (_("string index of %s converts to an offset of 0x%s which is too big for section %s"),
- dwarf_vmatoa ("d", idx),
- dwarf_vmatoa ("x", index_offset),
- str_section->name);
+ warn (_("string index of %" PRIu64 " converts to an offset of %#" PRIx64
+ " which is too big for section %s"),
+ idx, index_offset, str_section->name);
return _("<string index too big>");
}
str_offset -= str_section->address;
if (str_offset >= str_section->size)
{
- warn (_("indirect offset too big: 0x%s\n"),
- dwarf_vmatoa ("x", str_offset));
+ warn (_("indirect offset too big: %#" PRIx64 "\n"), str_offset);
return _("<indirect index offset is too big>");
}
return ret;
}
-static dwarf_vma
-fetch_indexed_addr (dwarf_vma offset, uint32_t num_bytes)
+static uint64_t
+fetch_indexed_addr (uint64_t offset, uint32_t num_bytes)
{
struct dwarf_section *section = &debug_displays [debug_addr].section;
if (offset + num_bytes > section->size)
{
- warn (_("Offset into section %s too big: 0x%s\n"),
- section->name, dwarf_vmatoa ("x", offset));
+ warn (_("Offset into section %s too big: %#" PRIx64 "\n"),
+ section->name, offset);
return 0;
}
something in another section (eg DW_FORM_loclistx or DW_FORM_rnglistx).
Returns -1 if the value could not be found. */
-static dwarf_vma
-fetch_indexed_value (dwarf_vma idx,
+static uint64_t
+fetch_indexed_value (uint64_t idx,
enum dwarf_section_display_enum sec_enum,
- dwarf_vma base_address)
+ uint64_t base_address)
{
struct dwarf_section *section = &debug_displays [sec_enum].section;
bias = 12;
}
- dwarf_vma offset = idx * pointer_size;
+ uint64_t offset = idx * pointer_size;
/* Offsets are biased by the size of the section header
or base address. */
if (offset + pointer_size > section->size)
{
- warn (_("Offset into section %s too big: 0x%s\n"),
- section->name, dwarf_vmatoa ("x", offset));
+ warn (_("Offset into section %s too big: %#" PRIx64 "\n"),
+ section->name, offset);
return -1;
}
/* Records a single attribute in an abbrev. */
typedef struct abbrev_attr
{
- unsigned long attribute;
- unsigned long form;
- dwarf_signed_vma implicit_const;
- struct abbrev_attr * next;
+ unsigned long attribute;
+ unsigned long form;
+ int64_t implicit_const;
+ struct abbrev_attr *next;
}
abbrev_attr;
typedef struct abbrev_map
{
- dwarf_vma start;
- dwarf_vma end;
- abbrev_list * list;
+ uint64_t start;
+ uint64_t end;
+ abbrev_list *list;
} abbrev_map;
/* Maps between CU offsets and abbrev sets. */
#define ABBREV_MAP_ENTRIES_INCREMENT 8
static void
-record_abbrev_list_for_cu (dwarf_vma start, dwarf_vma end,
+record_abbrev_list_for_cu (uint64_t start, uint64_t end,
abbrev_list *list, abbrev_list *free_list)
{
if (free_list != NULL)
Not caching abbrevs is likely the answer. */
static abbrev_map *
-find_abbrev_map_by_offset (dwarf_vma offset)
+find_abbrev_map_by_offset (uint64_t offset)
{
unsigned long i;
}
static void
-add_abbrev_attr (unsigned long attribute,
- unsigned long form,
- dwarf_signed_vma implicit_const,
- abbrev_list * list)
+add_abbrev_attr (unsigned long attribute,
+ unsigned long form,
+ int64_t implicit_const,
+ abbrev_list *list)
{
abbrev_attr *attr;
{
unsigned long form;
/* Initialize it due to a false compiler warning. */
- dwarf_signed_vma implicit_const = -1;
+ int64_t implicit_const = -1;
READ_ULEB (attribute, start, end);
if (start == end)
static abbrev_list *
find_and_process_abbrev_set (struct dwarf_section *section,
- dwarf_vma abbrev_base,
- dwarf_vma abbrev_size,
- dwarf_vma abbrev_offset,
+ uint64_t abbrev_base,
+ uint64_t abbrev_size,
+ uint64_t abbrev_offset,
abbrev_list **free_list)
{
if (free_list)
|| abbrev_size > section->size - abbrev_base)
{
/* PR 17531: file:4bcd9ce9. */
- warn (_("Debug info is corrupted, abbrev size (%lx) is larger than "
- "abbrev section size (%lx)\n"),
- (unsigned long) (abbrev_base + abbrev_size),
- (unsigned long) section->size);
+ warn (_("Debug info is corrupted, abbrev size (%#" PRIx64 ")"
+ " is larger than abbrev section size (%#" PRIx64 ")\n"),
+ abbrev_base + abbrev_size, section->size);
return NULL;
}
if (abbrev_offset >= abbrev_size)
{
- warn (_("Debug info is corrupted, abbrev offset (%lx) is larger than "
- "abbrev section size (%lx)\n"),
- (unsigned long) abbrev_offset,
- (unsigned long) abbrev_size);
+ warn (_("Debug info is corrupted, abbrev offset (%#" PRIx64 ")"
+ " is larger than abbrev section size (%#" PRIx64 ")\n"),
+ abbrev_offset, abbrev_size);
return NULL;
}
}
static const char *
-get_TAG_name (unsigned long tag)
+get_TAG_name (uint64_t tag)
{
- const char *name = get_DW_TAG_name ((unsigned int) tag);
+ const char *name = NULL;
+ if ((unsigned int) tag == tag)
+ name = get_DW_TAG_name ((unsigned int) tag);
if (name == NULL)
{
static char buffer[100];
if (tag >= DW_TAG_lo_user && tag <= DW_TAG_hi_user)
- snprintf (buffer, sizeof (buffer), _("User TAG value: %#lx"), tag);
+ snprintf (buffer, sizeof (buffer),
+ _("User TAG value: %#" PRIx64), tag);
else
- snprintf (buffer, sizeof (buffer), _("Unknown TAG value: %#lx"), tag);
+ snprintf (buffer, sizeof (buffer),
+ _("Unknown TAG value: %#" PRIx64), tag);
return buffer;
}
static const char *
get_FORM_name (unsigned long form)
{
- const char *name;
+ const char *name = NULL;
if (form == 0)
return "DW_FORM value: 0";
- name = get_DW_FORM_name (form);
+ if ((unsigned int) form == form)
+ name = get_DW_FORM_name ((unsigned int) form);
if (name == NULL)
{
static char buffer[100];
static const char *
get_IDX_name (unsigned long idx)
{
- const char *name = get_DW_IDX_name ((unsigned int) idx);
+ const char *name = NULL;
+ if ((unsigned int) idx == idx)
+ name = get_DW_IDX_name ((unsigned int) idx);
if (name == NULL)
{
static char buffer[100];
static unsigned char *
display_block (unsigned char *data,
- dwarf_vma length,
+ uint64_t length,
const unsigned char * const end, char delimiter)
{
- dwarf_vma maxlen;
+ size_t maxlen;
- printf (_("%c%s byte block: "), delimiter, dwarf_vmatoa ("u", length));
+ printf (_("%c%" PRIu64 " byte block: "), delimiter, length);
if (data > end)
return (unsigned char *) end;
- maxlen = (dwarf_vma) (end - data);
+ maxlen = end - data;
length = length > maxlen ? maxlen : length;
while (length --)
- printf ("%lx ", (unsigned long) byte_get (data++, 1));
+ printf ("%" PRIx64 " ", byte_get (data++, 1));
return data;
}
unsigned int pointer_size,
unsigned int offset_size,
int dwarf_version,
- dwarf_vma length,
- dwarf_vma cu_offset,
+ uint64_t length,
+ uint64_t cu_offset,
struct dwarf_section * section)
{
unsigned op;
- dwarf_vma uvalue;
- dwarf_signed_vma svalue;
+ uint64_t uvalue;
+ int64_t svalue;
unsigned char *end = data + length;
int need_frame_base = 0;
{
case DW_OP_addr:
SAFE_BYTE_GET_AND_INC (uvalue, data, pointer_size, end);
- printf ("DW_OP_addr: %s", dwarf_vmatoa ("x", uvalue));
+ printf ("DW_OP_addr: %" PRIx64, uvalue);
break;
case DW_OP_deref:
printf ("DW_OP_deref");
break;
case DW_OP_const1u:
SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
- printf ("DW_OP_const1u: %lu", (unsigned long) uvalue);
+ printf ("DW_OP_const1u: %" PRIu64, uvalue);
break;
case DW_OP_const1s:
SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 1, end);
- printf ("DW_OP_const1s: %ld", (long) svalue);
+ printf ("DW_OP_const1s: %" PRId64, svalue);
break;
case DW_OP_const2u:
SAFE_BYTE_GET_AND_INC (uvalue, data, 2, end);
- printf ("DW_OP_const2u: %lu", (unsigned long) uvalue);
+ printf ("DW_OP_const2u: %" PRIu64, uvalue);
break;
case DW_OP_const2s:
SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 2, end);
- printf ("DW_OP_const2s: %ld", (long) svalue);
+ printf ("DW_OP_const2s: %" PRId64, svalue);
break;
case DW_OP_const4u:
SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end);
- printf ("DW_OP_const4u: %lu", (unsigned long) uvalue);
+ printf ("DW_OP_const4u: %" PRIu64, uvalue);
break;
case DW_OP_const4s:
SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 4, end);
- printf ("DW_OP_const4s: %ld", (long) svalue);
+ printf ("DW_OP_const4s: %" PRId64, svalue);
break;
case DW_OP_const8u:
- SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end);
- printf ("DW_OP_const8u: %lu ", (unsigned long) uvalue);
- SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end);
- printf ("%lu", (unsigned long) uvalue);
+ SAFE_BYTE_GET_AND_INC (uvalue, data, 8, end);
+ printf ("DW_OP_const8u: %" PRIu64, uvalue);
break;
case DW_OP_const8s:
- SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 4, end);
- printf ("DW_OP_const8s: %ld ", (long) svalue);
- SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 4, end);
- printf ("%ld", (long) svalue);
+ SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 8, end);
+ printf ("DW_OP_const8s: %" PRId64, svalue);
break;
case DW_OP_constu:
READ_ULEB (uvalue, data, end);
- printf ("DW_OP_constu: %s", dwarf_vmatoa ("u", uvalue));
+ printf ("DW_OP_constu: %" PRIu64, uvalue);
break;
case DW_OP_consts:
READ_SLEB (svalue, data, end);
- printf ("DW_OP_consts: %s", dwarf_vmatoa ("d", svalue));
+ printf ("DW_OP_consts: %" PRId64, svalue);
break;
case DW_OP_dup:
printf ("DW_OP_dup");
break;
case DW_OP_pick:
SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
- printf ("DW_OP_pick: %ld", (unsigned long) uvalue);
+ printf ("DW_OP_pick: %" PRIu64, uvalue);
break;
case DW_OP_swap:
printf ("DW_OP_swap");
break;
case DW_OP_plus_uconst:
READ_ULEB (uvalue, data, end);
- printf ("DW_OP_plus_uconst: %s", dwarf_vmatoa ("u", uvalue));
+ printf ("DW_OP_plus_uconst: %" PRIu64, uvalue);
break;
case DW_OP_shl:
printf ("DW_OP_shl");
break;
case DW_OP_bra:
SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 2, end);
- printf ("DW_OP_bra: %ld", (long) svalue);
+ printf ("DW_OP_bra: %" PRId64, svalue);
break;
case DW_OP_eq:
printf ("DW_OP_eq");
break;
case DW_OP_skip:
SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 2, end);
- printf ("DW_OP_skip: %ld", (long) svalue);
+ printf ("DW_OP_skip: %" PRId64, svalue);
break;
case DW_OP_lit0:
case DW_OP_breg30:
case DW_OP_breg31:
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));
+ printf ("DW_OP_breg%d (%s): %" PRId64,
+ op - DW_OP_breg0, regname (op - DW_OP_breg0, 1), svalue);
break;
case DW_OP_regx:
READ_ULEB (uvalue, data, end);
- printf ("DW_OP_regx: %s (%s)",
- dwarf_vmatoa ("u", uvalue), regname (uvalue, 1));
+ printf ("DW_OP_regx: %" PRIu64 " (%s)",
+ uvalue, regname (uvalue, 1));
break;
case DW_OP_fbreg:
need_frame_base = 1;
READ_SLEB (svalue, data, end);
- printf ("DW_OP_fbreg: %s", dwarf_vmatoa ("d", svalue));
+ printf ("DW_OP_fbreg: %" PRId64, svalue);
break;
case DW_OP_bregx:
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", svalue));
+ printf ("DW_OP_bregx: %" PRIu64 " (%s) %" PRId64,
+ uvalue, regname (uvalue, 1), svalue);
break;
case DW_OP_piece:
READ_ULEB (uvalue, data, end);
- printf ("DW_OP_piece: %s", dwarf_vmatoa ("u", uvalue));
+ printf ("DW_OP_piece: %" PRIu64, uvalue);
break;
case DW_OP_deref_size:
SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
- printf ("DW_OP_deref_size: %ld", (long) uvalue);
+ printf ("DW_OP_deref_size: %" PRIu64, uvalue);
break;
case DW_OP_xderef_size:
SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
- printf ("DW_OP_xderef_size: %ld", (long) uvalue);
+ printf ("DW_OP_xderef_size: %" PRIu64, uvalue);
break;
case DW_OP_nop:
printf ("DW_OP_nop");
/* FIXME: Strictly speaking for 64-bit DWARF3 files
this ought to be an 8-byte wide computation. */
SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 2, end);
- printf ("DW_OP_call2: <0x%s>",
- dwarf_vmatoa ("x", svalue + cu_offset));
+ printf ("DW_OP_call2: <0x%" PRIx64 ">", svalue + cu_offset);
break;
case DW_OP_call4:
/* FIXME: Strictly speaking for 64-bit DWARF3 files
this ought to be an 8-byte wide computation. */
SAFE_SIGNED_BYTE_GET_AND_INC (svalue, data, 4, end);
- printf ("DW_OP_call4: <0x%s>",
- dwarf_vmatoa ("x", svalue + cu_offset));
+ printf ("DW_OP_call4: <0x%" PRIx64 ">", svalue + cu_offset);
break;
case DW_OP_call_ref:
/* FIXME: Strictly speaking for 64-bit DWARF3 files
{
SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
}
- printf ("DW_OP_call_ref: <0x%s>", dwarf_vmatoa ("x", uvalue));
+ printf ("DW_OP_call_ref: <0x%" PRIx64 ">", uvalue);
break;
case DW_OP_form_tls_address:
printf ("DW_OP_form_tls_address");
case DW_OP_bit_piece:
printf ("DW_OP_bit_piece: ");
READ_ULEB (uvalue, data, end);
- printf (_("size: %s "), dwarf_vmatoa ("u", uvalue));
+ printf (_("size: %" PRIu64 " "), uvalue);
READ_ULEB (uvalue, data, end);
- printf (_("offset: %s "), dwarf_vmatoa ("u", uvalue));
+ printf (_("offset: %" PRIu64 " "), uvalue);
break;
/* DWARF 4 extensions. */
case DW_OP_GNU_encoded_addr:
{
int encoding = 0;
- dwarf_vma addr;
+ uint64_t addr;
if (data < end)
encoding = *data++;
addr = get_encoded_value (&data, encoding, section, end);
printf ("DW_OP_GNU_encoded_addr: fmt:%02x addr:", encoding);
- print_dwarf_vma (addr, pointer_size);
+ print_hex (addr, pointer_size);
}
break;
case DW_OP_implicit_pointer:
SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
}
READ_SLEB (svalue, data, end);
- printf ("%s: <0x%s> %s",
+ printf ("%s: <0x%" PRIx64 "> %" PRId64,
(op == DW_OP_implicit_pointer
? "DW_OP_implicit_pointer" : "DW_OP_GNU_implicit_pointer"),
- dwarf_vmatoa ("x", uvalue),
- dwarf_vmatoa ("d", svalue));
+ uvalue, svalue);
break;
case DW_OP_entry_value:
case DW_OP_GNU_entry_value:
READ_ULEB (uvalue, data, end);
/* PR 17531: file: 0cc9cd00. */
- if (uvalue > (dwarf_vma) (end - data))
+ if (uvalue > (size_t) (end - data))
uvalue = end - data;
printf ("%s: (", (op == DW_OP_entry_value ? "DW_OP_entry_value"
: "DW_OP_GNU_entry_value"));
case DW_OP_const_type:
case DW_OP_GNU_const_type:
READ_ULEB (uvalue, data, end);
- printf ("%s: <0x%s> ",
+ printf ("%s: <0x%" PRIx64 "> ",
(op == DW_OP_const_type ? "DW_OP_const_type"
: "DW_OP_GNU_const_type"),
- dwarf_vmatoa ("x", cu_offset + uvalue));
+ cu_offset + uvalue);
SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
data = display_block (data, uvalue, end, ' ');
break;
case DW_OP_regval_type:
case DW_OP_GNU_regval_type:
READ_ULEB (uvalue, data, end);
- printf ("%s: %s (%s)",
+ printf ("%s: %" PRIu64 " (%s)",
(op == DW_OP_regval_type ? "DW_OP_regval_type"
: "DW_OP_GNU_regval_type"),
- dwarf_vmatoa ("u", uvalue), regname (uvalue, 1));
+ uvalue, regname (uvalue, 1));
READ_ULEB (uvalue, data, end);
- printf (" <0x%s>", dwarf_vmatoa ("x", cu_offset + uvalue));
+ printf (" <0x%" PRIx64 ">", cu_offset + uvalue);
break;
case DW_OP_deref_type:
case DW_OP_GNU_deref_type:
SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end);
- printf ("%s: %ld",
+ printf ("%s: %" PRId64,
(op == DW_OP_deref_type ? "DW_OP_deref_type"
: "DW_OP_GNU_deref_type"),
- (long) uvalue);
+ uvalue);
READ_ULEB (uvalue, data, end);
- printf (" <0x%s>", dwarf_vmatoa ("x", cu_offset + uvalue));
+ printf (" <0x%" PRIx64 ">", cu_offset + uvalue);
break;
case DW_OP_convert:
case DW_OP_GNU_convert:
READ_ULEB (uvalue, data, end);
- printf ("%s <0x%s>",
+ printf ("%s <0x%" PRIx64 ">",
(op == DW_OP_convert ? "DW_OP_convert" : "DW_OP_GNU_convert"),
- dwarf_vmatoa ("x", uvalue ? cu_offset + uvalue : 0));
+ uvalue ? cu_offset + uvalue : uvalue);
break;
case DW_OP_reinterpret:
case DW_OP_GNU_reinterpret:
READ_ULEB (uvalue, data, end);
- printf ("%s <0x%s>",
+ printf ("%s <0x%" PRIx64 ">",
(op == DW_OP_reinterpret ? "DW_OP_reinterpret"
: "DW_OP_GNU_reinterpret"),
- dwarf_vmatoa ("x", uvalue ? cu_offset + uvalue : 0));
+ uvalue ? cu_offset + uvalue : uvalue);
break;
case DW_OP_GNU_parameter_ref:
SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end);
- printf ("DW_OP_GNU_parameter_ref: <0x%s>",
- dwarf_vmatoa ("x", cu_offset + uvalue));
+ printf ("DW_OP_GNU_parameter_ref: <0x%" PRIx64 ">",
+ cu_offset + uvalue);
break;
case DW_OP_addrx:
READ_ULEB (uvalue, data, end);
- printf ("DW_OP_addrx <0x%s>", dwarf_vmatoa ("x", uvalue));
+ printf ("DW_OP_addrx <0x%" PRIx64 ">", uvalue);
break;
case DW_OP_GNU_addr_index:
READ_ULEB (uvalue, data, end);
- printf ("DW_OP_GNU_addr_index <0x%s>", dwarf_vmatoa ("x", uvalue));
+ printf ("DW_OP_GNU_addr_index <0x%" PRIx64 ">", uvalue);
break;
case DW_OP_GNU_const_index:
READ_ULEB (uvalue, data, end);
- printf ("DW_OP_GNU_const_index <0x%s>", dwarf_vmatoa ("x", uvalue));
+ printf ("DW_OP_GNU_const_index <0x%" PRIx64 ">", uvalue);
break;
case DW_OP_GNU_variable_value:
/* FIXME: Strictly speaking for 64-bit DWARF3 files
{
SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
}
- printf ("DW_OP_GNU_variable_value: <0x%s>", dwarf_vmatoa ("x", uvalue));
+ printf ("DW_OP_GNU_variable_value: <0x%" PRIx64 ">", uvalue);
break;
/* HP extensions. */
This is used for DWARF package files. */
static struct cu_tu_set *
-find_cu_tu_set_v2 (dwarf_vma cu_offset, int do_types)
+find_cu_tu_set_v2 (uint64_t cu_offset, int do_types)
{
struct cu_tu_set *p;
unsigned int nsets;
}
static const char *
-fetch_alt_indirect_string (dwarf_vma offset)
+fetch_alt_indirect_string (uint64_t offset)
{
separate_info * i;
return ret;
}
- warn (_("DW_FORM_GNU_strp_alt offset (%s) too big or no string sections available\n"),
- dwarf_vmatoa ("x", offset));
+ warn (_("DW_FORM_GNU_strp_alt offset (%#" PRIx64 ")"
+ " too big or no string sections available\n"), offset);
return _("<offset is too big>");
}
}
static void
-add_dwo_info (const char * value, dwarf_vma cu_offset, dwo_type type)
+add_dwo_info (const char * value, uint64_t cu_offset, dwo_type type)
{
dwo_info * dwinfo = xmalloc (sizeof * dwinfo);
}
static void
-add_dwo_name (const char * name, dwarf_vma cu_offset)
+add_dwo_name (const char * name, uint64_t cu_offset)
{
add_dwo_info (name, cu_offset, DWO_NAME);
}
static void
-add_dwo_dir (const char * dir, dwarf_vma cu_offset)
+add_dwo_dir (const char * dir, uint64_t cu_offset)
{
add_dwo_info (dir, cu_offset, DWO_DIR);
}
static void
-add_dwo_id (const char * id, dwarf_vma cu_offset)
+add_dwo_id (const char * id, uint64_t cu_offset)
{
add_dwo_info (id, cu_offset, DWO_ID);
}
/* Ensure that START + UVALUE is less than END.
Return an adjusted UVALUE if necessary to ensure this relationship. */
-static inline dwarf_vma
-check_uvalue (const unsigned char * start,
- dwarf_vma uvalue,
- const unsigned char * end)
+static inline uint64_t
+check_uvalue (const unsigned char *start,
+ uint64_t uvalue,
+ const unsigned char *end)
{
- dwarf_vma max_uvalue = end - start;
+ uint64_t max_uvalue = end - start;
/* See PR 17512: file: 008-103549-0.001:0.1.
and PR 24829 for examples of where these tests are triggered. */
if (uvalue > max_uvalue)
{
- warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue);
+ warn (_("Corrupt attribute block length: %#" PRIx64 "\n"), uvalue);
uvalue = max_uvalue;
}
skip_attr_bytes (unsigned long form,
unsigned char *data,
unsigned char *end,
- dwarf_vma pointer_size,
- dwarf_vma offset_size,
+ uint64_t pointer_size,
+ uint64_t offset_size,
int dwarf_version,
- dwarf_vma *value_return)
+ uint64_t *value_return)
{
- dwarf_signed_vma svalue;
- dwarf_vma uvalue = 0;
- dwarf_vma inc = 0;
+ int64_t svalue;
+ uint64_t uvalue = 0;
+ uint64_t inc = 0;
* value_return = 0;
}
* value_return = uvalue;
- if (inc <= (dwarf_vma) (end - data))
+ if (inc <= (size_t) (end - data))
data += inc;
else
data = end;
static abbrev_entry *
get_type_abbrev_from_form (unsigned long form,
unsigned long uvalue,
- dwarf_vma cu_offset,
+ uint64_t cu_offset,
unsigned char *cu_end,
const struct dwarf_section *section,
unsigned long *abbrev_num_return,
case DW_FORM_ref_addr:
if (uvalue >= section->size)
{
- warn (_("Unable to resolve ref_addr form: uvalue %lx > section size %lx (%s)\n"),
- uvalue, (long) section->size, section->name);
+ warn (_("Unable to resolve ref_addr form: uvalue %lx "
+ "> section size %" PRIx64 " (%s)\n"),
+ uvalue, section->size, section->name);
return NULL;
}
break;
if (uvalue + cu_offset < uvalue
|| uvalue + cu_offset > (size_t) (cu_end - section->start))
{
- warn (_("Unable to resolve ref form: uvalue %lx + cu_offset %lx > CU size %lx\n"),
- uvalue, (long) cu_offset, (long) (cu_end - section->start));
+ warn (_("Unable to resolve ref form: uvalue %lx + cu_offset %" PRIx64
+ " > CU size %tx\n"),
+ uvalue, cu_offset, cu_end - section->start);
return NULL;
}
uvalue += cu_offset;
const struct dwarf_section *section,
unsigned char *data,
unsigned char *end,
- dwarf_vma cu_offset,
- dwarf_vma pointer_size,
- dwarf_vma offset_size,
+ uint64_t cu_offset,
+ uint64_t pointer_size,
+ uint64_t offset_size,
int dwarf_version,
bool *is_signed,
unsigned int nesting)
attr = attr->next)
{
unsigned char * orig_data = data;
- dwarf_vma uvalue = 0;
+ uint64_t uvalue = 0;
data = skip_attr_bytes (attr->form, data, end, pointer_size,
offset_size, dwarf_version, & uvalue);
bool is_signed)
{
int status;
- dwarf_vma val = read_leb128 (data, end, is_signed, bytes_read, &status);
+ uint64_t val = read_leb128 (data, end, is_signed, bytes_read, &status);
if (status != 0)
report_leb_status (status);
+ else if (is_signed)
+ printf ("%" PRId64, val);
else
- printf ("%s", dwarf_vmatoa (is_signed ? "d" : "u", val));
+ printf ("%" PRIu64, val);
}
static void
-display_discr_list (unsigned long form,
- dwarf_vma uvalue,
- unsigned char * data,
- int level)
+display_discr_list (unsigned long form,
+ uint64_t uvalue,
+ unsigned char *data,
+ int level)
{
unsigned char *end = data;
}
static unsigned char *
-read_and_display_attr_value (unsigned long attribute,
- unsigned long form,
- dwarf_signed_vma implicit_const,
- unsigned char * start,
- unsigned char * data,
- unsigned char * end,
- dwarf_vma cu_offset,
- dwarf_vma pointer_size,
- dwarf_vma offset_size,
- int dwarf_version,
- debug_info * debug_info_p,
- int do_loc,
- struct dwarf_section * section,
- struct cu_tu_set * this_set,
- char delimiter,
- int level)
-{
- dwarf_signed_vma svalue;
- dwarf_vma uvalue = 0;
- dwarf_vma uvalue_hi = 0;
+read_and_display_attr_value (unsigned long attribute,
+ unsigned long form,
+ int64_t implicit_const,
+ unsigned char *start,
+ unsigned char *data,
+ unsigned char *end,
+ uint64_t cu_offset,
+ uint64_t pointer_size,
+ uint64_t offset_size,
+ int dwarf_version,
+ debug_info *debug_info_p,
+ int do_loc,
+ struct dwarf_section *section,
+ struct cu_tu_set *this_set,
+ char delimiter,
+ int level)
+{
+ int64_t svalue;
+ uint64_t uvalue = 0;
+ uint64_t uvalue_hi = 0;
unsigned char *block_start = NULL;
unsigned char *orig_data = data;
SAFE_BYTE_GET_AND_INC (uvalue_hi, data, 8, end);
if (byte_get != byte_get_little_endian)
{
- dwarf_vma utmp = uvalue;
+ uint64_t utmp = uvalue;
uvalue = uvalue_hi;
uvalue_hi = utmp;
}
{
case DW_FORM_ref_addr:
if (!do_loc)
- printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue));
+ printf ("%c<0x%" PRIx64 ">", delimiter, uvalue);
break;
case DW_FORM_GNU_ref_alt:
{
if (do_wide)
/* We have already printed the form name. */
- printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue));
+ printf ("%c<0x%" PRIx64 ">", delimiter, uvalue);
else
- printf ("%c<alt 0x%s>", delimiter, dwarf_vmatoa ("x", uvalue));
+ printf ("%c<alt 0x%" PRIx64 ">", delimiter, uvalue);
}
/* FIXME: Follow the reference... */
break;
case DW_FORM_ref_sup4:
case DW_FORM_ref_udata:
if (!do_loc)
- printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue + cu_offset));
+ printf ("%c<0x%" PRIx64 ">", delimiter, uvalue + cu_offset);
break;
case DW_FORM_data4:
case DW_FORM_addr:
case DW_FORM_sec_offset:
if (!do_loc)
- printf ("%c0x%s", delimiter, dwarf_vmatoa ("x", uvalue));
+ printf ("%c0x%" PRIx64, delimiter, uvalue);
break;
case DW_FORM_flag_present:
case DW_FORM_data2:
case DW_FORM_sdata:
if (!do_loc)
- printf ("%c%s", delimiter, dwarf_vmatoa ("d", uvalue));
+ printf ("%c%" PRId64, delimiter, uvalue);
break;
case DW_FORM_udata:
if (!do_loc)
- printf ("%c%s", delimiter, dwarf_vmatoa ("u", uvalue));
+ printf ("%c%" PRIu64, delimiter, uvalue);
break;
case DW_FORM_implicit_const:
if (!do_loc)
- printf ("%c%s", delimiter, dwarf_vmatoa ("d", implicit_const));
+ printf ("%c%" PRId64, delimiter, implicit_const);
break;
case DW_FORM_ref_sup8:
case DW_FORM_data8:
if (!do_loc)
{
- dwarf_vma utmp = uvalue;
+ uint64_t utmp = uvalue;
if (form == DW_FORM_ref8)
utmp += cu_offset;
- printf ("%c0x%s", delimiter, dwarf_vmatoa ("x", utmp));
+ printf ("%c0x%" PRIx64, delimiter, utmp);
}
break;
case DW_FORM_data16:
if (!do_loc)
- printf (" 0x%s%s",
- uvalue_hi == 0 ? "" : dwarf_vmatoa ("x", uvalue_hi),
- dwarf_vmatoa_1 ("x", uvalue, uvalue_hi == 0 ? 0 : 8));
+ {
+ if (uvalue_hi == 0)
+ printf (" 0x%" PRIx64, uvalue);
+ else
+ printf (" 0x%" PRIx64 "%016" PRIx64, uvalue_hi, uvalue);
+ }
break;
case DW_FORM_string:
{
if (do_wide)
/* We have already displayed the form name. */
- printf (_("%c(offset: 0x%s): %s"), delimiter,
- dwarf_vmatoa ("x", uvalue),
- fetch_indirect_string (uvalue));
+ printf (_("%c(offset: 0x%" PRIx64 "): %s"),
+ delimiter, uvalue, fetch_indirect_string (uvalue));
else
- printf (_("%c(indirect string, offset: 0x%s): %s"), delimiter,
- dwarf_vmatoa ("x", uvalue),
- fetch_indirect_string (uvalue));
+ printf (_("%c(indirect string, offset: 0x%" PRIx64 "): %s"),
+ delimiter, uvalue, fetch_indirect_string (uvalue));
}
break;
{
if (do_wide)
/* We have already displayed the form name. */
- printf (_("%c(offset: 0x%s): %s"), delimiter,
- dwarf_vmatoa ("x", uvalue),
- fetch_indirect_line_string (uvalue));
+ printf (_("%c(offset: 0x%" PRIx64 "): %s"),
+ delimiter, uvalue, fetch_indirect_line_string (uvalue));
else
- printf (_("%c(indirect line string, offset: 0x%s): %s"), delimiter,
- dwarf_vmatoa ("x", uvalue),
- fetch_indirect_line_string (uvalue));
+ printf (_("%c(indirect line string, offset: 0x%" PRIx64 "): %s"),
+ delimiter, uvalue, fetch_indirect_line_string (uvalue));
}
break;
debug_info_p ? debug_info_p->str_offsets_base : 0);
if (do_wide)
/* We have already displayed the form name. */
- printf (_("%c(offset: 0x%s): %s"), delimiter,
- dwarf_vmatoa ("x", uvalue), strng);
+ printf (_("%c(offset: 0x%" PRIx64 "): %s"),
+ delimiter, uvalue, strng);
else
- printf (_("%c(indexed string: 0x%s): %s"), delimiter,
- dwarf_vmatoa ("x", uvalue), strng);
+ printf (_("%c(indexed string: 0x%" PRIx64 "): %s"),
+ delimiter, uvalue, strng);
}
break;
{
if (do_wide)
/* We have already displayed the form name. */
- printf (_("%c(offset: 0x%s) %s"), delimiter,
- dwarf_vmatoa ("x", uvalue),
- fetch_alt_indirect_string (uvalue));
+ printf (_("%c(offset: 0x%" PRIx64 ") %s"),
+ delimiter, uvalue, fetch_alt_indirect_string (uvalue));
else
- printf (_("%c(alt indirect string, offset: 0x%s) %s"), delimiter,
- dwarf_vmatoa ("x", uvalue),
- fetch_alt_indirect_string (uvalue));
+ printf (_("%c(alt indirect string, offset: 0x%" PRIx64 ") %s"),
+ delimiter, uvalue, fetch_alt_indirect_string (uvalue));
}
break;
case DW_FORM_ref_sig8:
if (!do_loc)
- printf ("%c%s: 0x%s", delimiter, do_wide ? "" : "signature",
- dwarf_vmatoa ("x", uvalue));
+ printf ("%c%s: 0x%" PRIx64, delimiter, do_wide ? "" : "signature",
+ uvalue);
break;
case DW_FORM_GNU_addr_index:
case DW_FORM_rnglistx:
if (!do_loc)
{
- dwarf_vma base, idx;
+ uint64_t base, idx;
const char *suffix = strrchr (section->name, '.');
bool dwo = suffix && strcmp (suffix, ".dwo") == 0;
if (dwo)
{
idx = fetch_indexed_value (uvalue, loclists_dwo, 0);
- if (idx != (dwarf_vma) -1)
+ if (idx != (uint64_t) -1)
idx += (offset_size == 8) ? 20 : 12;
}
else if (debug_info_p == NULL)
if (dwo)
{
idx = fetch_indexed_value (uvalue, rnglists_dwo, 0);
- if (idx != (dwarf_vma) -1)
+ if (idx != (uint64_t) -1)
idx += (offset_size == 8) ? 20 : 12;
}
else
/* We do not have a cached value this time, so we perform the
computation manually. */
idx = fetch_indexed_value (uvalue, rnglists, base);
- if (idx != (dwarf_vma) -1)
+ if (idx != (uint64_t) -1)
idx += base;
}
}
}
/* We have already displayed the form name. */
- if (idx != (dwarf_vma) -1)
- printf (_("%c(index: 0x%s): %s"), delimiter,
- dwarf_vmatoa ("x", uvalue),
- dwarf_vmatoa ("x", idx));
+ if (idx != (uint64_t) -1)
+ printf (_("%c(index: 0x%" PRIx64 "): %" PRIx64),
+ delimiter, uvalue, idx);
}
break;
case DW_FORM_strp_sup:
if (!do_loc)
- printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue + cu_offset));
+ printf ("%c<0x%" PRIx64 ">", delimiter, uvalue + cu_offset);
break;
default:
{
case DW_AT_loclists_base:
if (debug_info_p->loclists_base)
- warn (_("CU @ 0x%s has multiple loclists_base values (0x%s and 0x%s)"),
- dwarf_vmatoa ("x", debug_info_p->cu_offset),
- dwarf_vmatoa ("x", debug_info_p->loclists_base),
- dwarf_vmatoa ("x", uvalue));
+ warn (_("CU @ %#" PRIx64 " has multiple loclists_base values "
+ "(%#" PRIx64 " and %#" PRIx64 ")"),
+ debug_info_p->cu_offset,
+ debug_info_p->loclists_base, uvalue);
debug_info_p->loclists_base = uvalue;
break;
case DW_AT_rnglists_base:
if (debug_info_p->rnglists_base)
- warn (_("CU @ 0x%s has multiple rnglists_base values (0x%s and 0x%s)"),
- dwarf_vmatoa ("x", debug_info_p->cu_offset),
- dwarf_vmatoa ("x", debug_info_p->rnglists_base),
- dwarf_vmatoa ("x", uvalue));
+ warn (_("CU @ %#" PRIx64 " has multiple rnglists_base values "
+ "(%#" PRIx64 " and %#" PRIx64 ")"),
+ debug_info_p->cu_offset,
+ debug_info_p->rnglists_base, uvalue);
debug_info_p->rnglists_base = uvalue;
break;
case DW_AT_str_offsets_base:
if (debug_info_p->str_offsets_base)
- warn (_("CU @ 0x%s has multiple str_offsets_base values (0x%s and 0x%s)"),
- dwarf_vmatoa ("x", debug_info_p->cu_offset),
- dwarf_vmatoa ("x", debug_info_p->str_offsets_base),
- dwarf_vmatoa ("x", uvalue));
+ warn (_("CU @ %#" PRIx64 " has multiple str_offsets_base values "
+ "%#" PRIx64 " and %#" PRIx64 ")"),
+ debug_info_p->cu_offset,
+ debug_info_p->str_offsets_base, uvalue);
debug_info_p->str_offsets_base = uvalue;
break;
if (lmax == 0 || num >= lmax)
{
lmax += 1024;
- debug_info_p->loc_offsets = (dwarf_vma *)
+ debug_info_p->loc_offsets = (uint64_t *)
xcrealloc (debug_info_p->loc_offsets,
lmax, sizeof (*debug_info_p->loc_offsets));
- debug_info_p->loc_views = (dwarf_vma *)
+ debug_info_p->loc_views = (uint64_t *)
xcrealloc (debug_info_p->loc_views,
lmax, sizeof (*debug_info_p->loc_views));
debug_info_p->have_frame_base = (int *)
if (lmax == 0 || num >= lmax)
{
lmax += 1024;
- debug_info_p->range_lists = (dwarf_vma *)
+ debug_info_p->range_lists = (uint64_t *)
xcrealloc (debug_info_p->range_lists,
lmax, sizeof (*debug_info_p->range_lists));
debug_info_p->max_range_lists = lmax;
printf (_("(declared as inline and inlined)"));
break;
default:
- printf (_(" (Unknown inline attribute value: %s)"),
- dwarf_vmatoa ("x", uvalue));
+ printf (_(" (Unknown inline attribute value: %#" PRIx64 ")"),
+ uvalue);
break;
}
break;
case DW_LANG_Upc: printf ("(Unified Parallel C)"); break;
default:
if (uvalue >= DW_LANG_lo_user && uvalue <= DW_LANG_hi_user)
- printf (_("(implementation defined: %s)"),
- dwarf_vmatoa ("x", uvalue));
+ printf (_("(implementation defined: %#" PRIx64 ")"), uvalue);
else
- printf (_("(Unknown: %s)"), dwarf_vmatoa ("x", uvalue));
+ printf (_("(unknown: %#" PRIx64 ")"), uvalue);
break;
}
break;
if (entry == NULL)
{
if (form != DW_FORM_GNU_ref_alt)
- warn (_("Offset %s used as value for DW_AT_import attribute of DIE at offset 0x%lx is too big.\n"),
- dwarf_vmatoa ("x", uvalue),
- (unsigned long) (orig_data - section->start));
+ warn (_("Offset %#" PRIx64 " used as value for DW_AT_import attribute of DIE at offset %#tx is too big.\n"),
+ uvalue,
+ orig_data - section->start);
}
else
{
}
static unsigned char *
-read_and_display_attr (unsigned long attribute,
- unsigned long form,
- dwarf_signed_vma implicit_const,
- unsigned char * start,
- unsigned char * data,
- unsigned char * end,
- dwarf_vma cu_offset,
- dwarf_vma pointer_size,
- dwarf_vma offset_size,
- int dwarf_version,
- debug_info * debug_info_p,
- int do_loc,
- struct dwarf_section * section,
- struct cu_tu_set * this_set,
- int level)
+read_and_display_attr (unsigned long attribute,
+ unsigned long form,
+ int64_t implicit_const,
+ unsigned char *start,
+ unsigned char *data,
+ unsigned char *end,
+ uint64_t cu_offset,
+ uint64_t pointer_size,
+ uint64_t offset_size,
+ int dwarf_version,
+ debug_info *debug_info_p,
+ int do_loc,
+ struct dwarf_section *section,
+ struct cu_tu_set *this_set,
+ int level)
{
if (!do_loc)
printf (" %-18s:", get_AT_name (attribute));
for (section_begin = start, num_units = 0; section_begin < end;
num_units ++)
{
- dwarf_vma length;
+ uint64_t length;
/* Read the first 4 bytes. For a 32-bit DWARF section, this
will be the length. For a 64-bit DWARF section, it'll be
SAFE_BYTE_GET_AND_INC (length, section_begin, 8, end);
else if (length >= 0xfffffff0 && length < 0xffffffff)
{
- warn (_("Reserved length value (0x%s) found in section %s\n"),
- dwarf_vmatoa ("x", length), section->name);
+ warn (_("Reserved length value (%#" PRIx64 ") found in section %s\n"),
+ length, section->name);
return false;
}
relocations to an object file, or if the file is corrupt. */
if (length > (size_t) (end - section_begin))
{
- warn (_("Corrupt unit length (got 0x%s expected at most 0x%s) in section %s\n"),
- dwarf_vmatoa ("x", length),
- dwarf_vmatoa ("x", end - section_begin),
- section->name);
+ warn (_("Corrupt unit length (got %#" PRIx64
+ " expected at most %#tx) in section %s\n"),
+ length, end - section_begin, section->name);
return false;
}
section_begin += length;
every CU header twice. */
for (section_begin = start; start < end;)
{
- DWARF2_Internal_CompUnit compunit;
- unsigned char * hdrptr;
- dwarf_vma abbrev_base;
- size_t abbrev_size;
- dwarf_vma cu_offset;
- unsigned int offset_size;
- struct cu_tu_set * this_set;
+ DWARF2_Internal_CompUnit compunit;
+ unsigned char *hdrptr;
+ uint64_t abbrev_base;
+ size_t abbrev_size;
+ uint64_t cu_offset;
+ unsigned int offset_size;
+ struct cu_tu_set *this_set;
unsigned char *end_cu;
hdrptr = start;
unsigned char *hdrptr;
unsigned char *tags;
int level, last_level, saved_level;
- dwarf_vma cu_offset;
+ uint64_t cu_offset;
unsigned int offset_size;
- dwarf_vma signature = 0;
- dwarf_vma type_offset = 0;
+ uint64_t signature = 0;
+ uint64_t type_offset = 0;
struct cu_tu_set *this_set;
- dwarf_vma abbrev_base;
+ uint64_t abbrev_base;
size_t abbrev_size;
unsigned char *end_cu;
if (!do_loc && dwarf_start_die == 0)
{
- printf (_(" Compilation Unit @ offset 0x%s:\n"),
- dwarf_vmatoa ("x", cu_offset));
- printf (_(" Length: 0x%s (%s)\n"),
- dwarf_vmatoa ("x", compunit.cu_length),
+ printf (_(" Compilation Unit @ offset 0x%" PRIx64 ":\n"),
+ cu_offset);
+ printf (_(" Length: 0x%" PRIx64 " (%s)\n"),
+ compunit.cu_length,
offset_size == 8 ? "64-bit" : "32-bit");
printf (_(" Version: %d\n"), compunit.cu_version);
if (compunit.cu_version >= 5)
name ? name : "???",
compunit.cu_unit_type);
}
- printf (_(" Abbrev Offset: 0x%s\n"),
- dwarf_vmatoa ("x", compunit.cu_abbrev_offset));
+ printf (_(" Abbrev Offset: 0x%" PRIx64 "\n"),
+ compunit.cu_abbrev_offset);
printf (_(" Pointer Size: %d\n"), compunit.cu_pointer_size);
if (do_types)
{
- printf (_(" Signature: 0x%s\n"),
- dwarf_vmatoa ("x", signature));
- printf (_(" Type Offset: 0x%s\n"),
- dwarf_vmatoa ("x", type_offset));
+ printf (_(" Signature: 0x%" PRIx64 "\n"), signature);
+ printf (_(" Type Offset: 0x%" PRIx64 "\n"), type_offset);
}
if (do_dwo_id)
- printf (_(" DWO ID: 0x%s\n"), dwarf_vmatoa ("x", dwo_id));
+ printf (_(" DWO ID: 0x%" PRIx64 "\n"), dwo_id);
if (this_set != NULL)
{
- dwarf_vma *offsets = this_set->section_offsets;
+ uint64_t *offsets = this_set->section_offsets;
size_t *sizes = this_set->section_sizes;
printf (_(" Section contributions:\n"));
- printf (_(" .debug_abbrev.dwo: 0x%s 0x%s\n"),
- dwarf_vmatoa ("x", offsets [DW_SECT_ABBREV]),
- dwarf_vmatoa ("x", sizes [DW_SECT_ABBREV]));
- printf (_(" .debug_line.dwo: 0x%s 0x%s\n"),
- dwarf_vmatoa ("x", offsets [DW_SECT_LINE]),
- dwarf_vmatoa ("x", sizes [DW_SECT_LINE]));
- printf (_(" .debug_loc.dwo: 0x%s 0x%s\n"),
- dwarf_vmatoa ("x", offsets [DW_SECT_LOC]),
- dwarf_vmatoa ("x", sizes [DW_SECT_LOC]));
- printf (_(" .debug_str_offsets.dwo: 0x%s 0x%s\n"),
- dwarf_vmatoa ("x", offsets [DW_SECT_STR_OFFSETS]),
- dwarf_vmatoa ("x", sizes [DW_SECT_STR_OFFSETS]));
+ printf (_(" .debug_abbrev.dwo: 0x%" PRIx64 " 0x%zx\n"),
+ offsets[DW_SECT_ABBREV], sizes[DW_SECT_ABBREV]);
+ printf (_(" .debug_line.dwo: 0x%" PRIx64 " 0x%zx\n"),
+ offsets[DW_SECT_LINE], sizes[DW_SECT_LINE]);
+ printf (_(" .debug_loc.dwo: 0x%" PRIx64 " 0x%zx\n"),
+ offsets[DW_SECT_LOC], sizes[DW_SECT_LOC]);
+ printf (_(" .debug_str_offsets.dwo: 0x%" PRIx64 " 0x%zx\n"),
+ offsets[DW_SECT_STR_OFFSETS], sizes[DW_SECT_STR_OFFSETS]);
}
}
if (compunit.cu_version < 2 || compunit.cu_version > 5)
{
- warn (_("CU at offset %s contains corrupt or "
+ warn (_("CU at offset %#" PRIx64 " contains corrupt or "
"unsupported version number: %d.\n"),
- dwarf_vmatoa ("x", cu_offset), compunit.cu_version);
+ cu_offset, compunit.cu_version);
continue;
}
&& compunit.cu_unit_type != DW_UT_split_compile
&& compunit.cu_unit_type != DW_UT_skeleton)
{
- warn (_("CU at offset %s contains corrupt or "
+ warn (_("CU at offset %#" PRIx64 " contains corrupt or "
"unsupported unit type: %d.\n"),
- dwarf_vmatoa ("x", cu_offset), compunit.cu_unit_type);
+ cu_offset, compunit.cu_unit_type);
continue;
}
printf ("\n");
fflush (stdout);
}
- warn (_("DIE at offset 0x%lx refers to abbreviation number %lu which does not exist\n"),
+ warn (_("DIE at offset %#lx refers to abbreviation number %lu which does not exist\n"),
die_offset, abbrev_number);
return false;
}
{
if (! do_loc && do_printing)
/* Show the offset from where the tag was extracted. */
- printf (" <%lx>", (unsigned long)(tags - section_begin));
+ printf (" <%tx>", tags - section_begin);
tags = read_and_display_attr (attr->attribute,
attr->form,
attr->implicit_const,
switch (debug_info_p->num_loc_offsets - debug_info_p->num_loc_views)
{
case 1:
- debug_info_p->loc_views [debug_info_p->num_loc_views] = vm1;
+ debug_info_p->loc_views [debug_info_p->num_loc_views] = -1;
debug_info_p->num_loc_views++;
assert (debug_info_p->num_loc_views
== debug_info_p->num_loc_offsets);
}
else
{
- warn (_("The length field (0x%lx) in the debug_line header is wrong - the section is too small\n"),
- (long) linfo->li_length);
+ warn (_("The length field (%#" PRIx64 ")"
+ " in the debug_line header is wrong"
+ " - the section is too small\n"),
+ linfo->li_length);
return NULL;
}
}
bool is_dir)
{
unsigned char *format_start, format_count, *format, formati;
- dwarf_vma data_count, datai;
+ uint64_t data_count, datai;
unsigned int namepass, last_entry = 0;
const char * table_name = is_dir ? N_("Directory Table") : N_("File Name Table");
}
else if (data >= end)
{
- warn (_("%s: Corrupt entry count - expected %s but none found\n"),
- table_name, dwarf_vmatoa ("x", data_count));
+ warn (_("%s: Corrupt entry count - expected %#" PRIx64
+ " but none found\n"), table_name, data_count);
return data;
}
return end;
}
- printf (_("\n The %s (offset 0x%lx, lines %s, columns %u):\n"),
- table_name, (long) (data - start), dwarf_vmatoa ("u", data_count),
- format_count);
+ printf (_("\n The %s (offset 0x%tx, lines %" PRIu64 ", columns %u):\n"),
+ table_name, data - start, data_count, format_count);
printf (_(" Entry"));
/* Delay displaying name as the last entry for better screen layout. */
format = format_start;
for (formati = 0; formati < format_count; formati++)
{
- dwarf_vma content_type;
+ uint64_t content_type;
READ_ULEB (content_type, format, end);
if ((content_type == DW_LNCT_path) == (namepass == 1))
printf (_("\tMD5\t\t\t"));
break;
default:
- printf (_("\t(Unknown format content type %s)"),
- dwarf_vmatoa ("u", content_type));
+ printf (_("\t(Unknown format content type %" PRIu64 ")"),
+ content_type);
}
SKIP_ULEB (format, end);
}
data = datapass;
for (formati = 0; formati < format_count; formati++)
{
- dwarf_vma content_type, form;
+ uint64_t content_type, form;
READ_ULEB (content_type, format, end);
READ_ULEB (form, format, end);
size_t sup_filename_len;
unsigned int num_read;
int status;
- dwarf_vma checksum_len;
+ uint64_t checksum_len;
introduce (section, true);
checksum_len = 0;
}
start += num_read;
- if (checksum_len > (dwarf_vma) (end - start))
+ if (checksum_len > (size_t) (end - start))
{
error (_("corrupt .debug_sup section: checksum length is longer than the remaining section length\n"));
checksum_len = end - start;
}
- else if (checksum_len < (dwarf_vma) (end - start))
+ else if (checksum_len < (size_t) (end - start))
{
- warn (_("corrupt .debug_sup section: there are 0x%lx extra, unused bytes at the end of the section\n"),
- (long) ((end - start) - checksum_len));
+ warn (_("corrupt .debug_sup section: there are %#" PRIx64
+ " extra, unused bytes at the end of the section\n"),
+ (end - start) - checksum_len);
}
printf (_(" Version: %u\n"), version);
printf (_(" Is Supp: %u\n"), is_supplementary);
printf (_(" Filename: %s\n"), sup_filename);
- printf (_(" Checksum Len: %lu\n"), (long) checksum_len);
+ printf (_(" Checksum Len: %" PRIu64 "\n"), checksum_len);
if (checksum_len > 0)
{
printf (_(" Checksum: "));
& end_of_sequence)) == NULL)
return 0;
- printf (_(" Offset: 0x%lx\n"), (long)(data - start));
- printf (_(" Length: %ld\n"), (long) linfo.li_length);
+ printf (_(" Offset: 0x%tx\n"), data - start);
+ printf (_(" Length: %" PRId64 "\n"), linfo.li_length);
printf (_(" DWARF Version: %d\n"), linfo.li_version);
if (linfo.li_version >= 5)
{
{
unsigned int last_dir_entry = 0;
- printf (_("\n The Directory Table (offset 0x%lx):\n"),
- (long)(data - start));
+ printf (_("\n The Directory Table (offset 0x%tx):\n"),
+ data - start);
while (data < end && *data != 0)
{
printf (_("\n The File Name Table is empty.\n"));
else
{
- printf (_("\n The File Name Table (offset 0x%lx):\n"),
- (long)(data - start));
+ printf (_("\n The File Name Table (offset 0x%tx):\n"),
+ data - start);
printf (_(" Entry\tDir\tTime\tSize\tName\n"));
while (data < end && *data != 0)
{
unsigned char *name;
- dwarf_vma val;
+ uint64_t val;
printf (" %d\t", ++state_machine_regs.last_file_entry);
name = data;
data++;
READ_ULEB (val, data, end);
- printf ("%s\t", dwarf_vmatoa ("u", val));
+ printf ("%" PRIu64 "\t", val);
READ_ULEB (val, data, end);
- printf ("%s\t", dwarf_vmatoa ("u", val));
+ printf ("%" PRIu64 "\t", val);
READ_ULEB (val, data, end);
- printf ("%s\t", dwarf_vmatoa ("u", val));
+ printf ("%" PRIu64 "\t", val);
printf ("%.*s\n", (int)(end - name), name);
if (data >= end)
while (data < end_of_sequence)
{
unsigned char op_code;
- dwarf_signed_vma adv;
- dwarf_vma uladv;
+ int64_t adv;
+ uint64_t uladv;
- printf (" [0x%08lx]", (long)(data - start));
+ printf (" [0x%08tx]", data - start);
op_code = *data++;
if (uladv)
state_machine_regs.view = 0;
printf (_(" Special opcode %d: "
- "advance Address by %s to 0x%s%s"),
- op_code, dwarf_vmatoa ("u", uladv),
- dwarf_vmatoa ("x", state_machine_regs.address),
+ "advance Address by %" PRIu64
+ " to 0x%" PRIx64 "%s"),
+ op_code, uladv, state_machine_regs.address,
verbose_view && uladv
? _(" (reset view)") : "");
}
if (addrdelta)
state_machine_regs.view = 0;
printf (_(" Special opcode %d: "
- "advance Address by %s to 0x%s[%d]%s"),
- op_code, dwarf_vmatoa ("u", uladv),
- dwarf_vmatoa ("x", state_machine_regs.address),
+ "advance Address by %" PRIu64
+ " to 0x%" PRIx64 "[%d]%s"),
+ op_code, uladv, state_machine_regs.address,
state_machine_regs.op_index,
verbose_view && addrdelta
? _(" (reset view)") : "");
}
adv = (op_code % linfo.li_line_range) + linfo.li_line_base;
state_machine_regs.line += adv;
- printf (_(" and Line by %s to %d"),
- dwarf_vmatoa ("d", adv), state_machine_regs.line);
+ printf (_(" and Line by %" PRId64 " to %d"),
+ adv, state_machine_regs.line);
if (verbose_view || state_machine_regs.view)
printf (_(" (view %u)\n"), state_machine_regs.view);
else
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),
+ printf (_(" Advance PC by %" PRIu64
+ " to 0x%" PRIx64 "%s\n"),
+ uladv, state_machine_regs.address,
verbose_view && uladv
? _(" (reset view)") : "");
}
% 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),
+ printf (_(" Advance PC by %" PRIu64
+ " to 0x%" PRIx64 "[%d]%s\n"),
+ uladv, state_machine_regs.address,
state_machine_regs.op_index,
verbose_view && addrdelta
? _(" (reset view)") : "");
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);
+ printf (_(" Advance Line by %" PRId64 " to %d\n"),
+ 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));
+ printf (_(" Set File Name to entry %" PRIu64
+ " in the File Name Table\n"), 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));
+ printf (_(" Set column to %" PRIu64 "\n"), 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));
+ printf (_(" Set is_stmt to %" PRId64 "\n"), adv);
state_machine_regs.is_stmt = adv;
break;
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),
+ printf (_(" Advance PC by constant %" PRIu64
+ " to 0x%" PRIx64 "%s\n"),
+ uladv, state_machine_regs.address,
verbose_view && uladv
? _(" (reset view)") : "");
}
% 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),
+ printf (_(" Advance PC by constant %" PRIu64
+ " to 0x%" PRIx64 "[%d]%s\n"),
+ uladv, state_machine_regs.address,
state_machine_regs.op_index,
verbose_view && addrdelta
? _(" (reset view)") : "");
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));
+ printf (_(" Advance PC by fixed size amount %" PRIu64
+ " to 0x%" PRIx64 "\n"),
+ uladv, state_machine_regs.address);
/* Do NOT reset view. */
break;
case DW_LNS_set_isa:
READ_ULEB (uladv, data, end);
- printf (_(" Set ISA to %s\n"), dwarf_vmatoa ("u", uladv));
+ printf (_(" Set ISA to %" PRIu64 "\n"), uladv);
break;
default:
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 ? "" : ", ");
+ printf ("0x%" PRIx64 "%s", uladv, i == 1 ? "" : ", ");
}
putchar ('\n');
break;
File_Entry *file_table = NULL;
unsigned int n_files = 0;
unsigned char **directory_table = NULL;
- dwarf_vma n_directories = 0;
+ uint64_t n_directories = 0;
if (startswith (section->name, ".debug_line.")
/* Note: the following does not apply to .debug_line.dwo sections.
if (linfo.li_version >= 5)
{
unsigned char *format_start, format_count, *format;
- dwarf_vma formati, entryi;
+ uint64_t formati, entryi;
load_debug_section_with_follow (line_str, fileptr);
format = format_start;
for (formati = 0; formati < format_count; formati++)
{
- dwarf_vma content_type, form;
- dwarf_vma uvalue;
+ uint64_t content_type, form;
+ uint64_t uvalue;
READ_ULEB (content_type, format, end);
READ_ULEB (form, format, end);
format = format_start;
for (formati = 0; formati < format_count; formati++)
{
- dwarf_vma content_type, form;
- dwarf_vma uvalue;
+ uint64_t content_type, form;
+ uint64_t uvalue;
unsigned char *tmp;
READ_ULEB (content_type, format, end);
directory = _("<unknown>");
else if (ix > n_directories)
{
- warn (_("directory index %u > number of directories %s\n"),
- ix, dwarf_vmatoa ("u", n_directories));
+ warn (_("directory index %u > number of directories %" PRIu64 "\n"),
+ ix, n_directories);
directory = _("<corrupt>");
}
else
/* PR 20439 */
else if (dir > n_directories)
{
- warn (_("directory index %u > number of directories %s\n"),
- dir, dwarf_vmatoa ("u", n_directories));
+ warn (_("directory index %u > number of directories %" PRIu64 "\n"),
+ dir, n_directories);
printf (_("\n <over large directory table entry %u>\n"), dir);
}
else
if (standard_opcodes != NULL)
for (i = standard_opcodes[op_code - 1]; i > 0 ; --i)
{
- dwarf_vma val;
+ uint64_t val;
READ_ULEB (val, data, end);
- printf ("0x%s%s", dwarf_vmatoa ("x", val),
- i == 1 ? "" : ", ");
+ printf ("0x%" PRIx64 "%s", val, i == 1 ? "" : ", ");
}
putchar ('\n');
break;
if (linfo.li_max_ops_per_insn == 1)
{
if (xop == -DW_LNE_end_sequence)
- printf ("%-35s %11s %#18" DWARF_VMA_FMT "x",
+ printf ("%-35s %11s %#18" PRIx64,
newFileName, "-",
state_machine_regs.address);
else
- printf ("%-35s %11d %#18" DWARF_VMA_FMT "x",
+ printf ("%-35s %11d %#18" PRIx64,
newFileName, state_machine_regs.line,
state_machine_regs.address);
}
else
{
if (xop == -DW_LNE_end_sequence)
- printf ("%-35s %11s %#18" DWARF_VMA_FMT "x[%d]",
+ printf ("%-35s %11s %#18" PRIx64 "[%d]",
newFileName, "-",
state_machine_regs.address,
state_machine_regs.op_index);
else
- printf ("%-35s %11d %#18" DWARF_VMA_FMT "x[%d]",
+ printf ("%-35s %11d %#18" PRIx64 "[%d]",
newFileName, state_machine_regs.line,
state_machine_regs.address,
state_machine_regs.op_index);
if (linfo.li_max_ops_per_insn == 1)
{
if (xop == -DW_LNE_end_sequence)
- printf ("%s %11s %#18" DWARF_VMA_FMT "x",
+ printf ("%s %11s %#18" PRIx64,
newFileName, "-",
state_machine_regs.address);
else
- printf ("%s %11d %#18" DWARF_VMA_FMT "x",
+ printf ("%s %11d %#18" PRIx64,
newFileName, state_machine_regs.line,
state_machine_regs.address);
}
else
{
if (xop == -DW_LNE_end_sequence)
- printf ("%s %11s %#18" DWARF_VMA_FMT "x[%d]",
+ printf ("%s %11s %#18" PRIx64 "[%d]",
newFileName, "-",
state_machine_regs.address,
state_machine_regs.op_index);
else
- printf ("%s %11d %#18" DWARF_VMA_FMT "x[%d]",
+ printf ("%s %11d %#18" PRIx64 "[%d]",
newFileName, state_machine_regs.line,
state_machine_regs.address,
state_machine_regs.op_index);
}
static debug_info *
-find_debug_info_for_offset (dwarf_vma offset)
+find_debug_info_for_offset (uint64_t offset)
{
unsigned int i;
if (names.pn_length > (size_t) (end - start))
{
- warn (_("Debug info is corrupted, %s header at %#lx has length %s\n"),
- section->name,
- sec_off,
- dwarf_vmatoa ("x", names.pn_length));
+ warn (_("Debug info is corrupted, "
+ "%s header at %#lx has length %#" PRIx64 "\n"),
+ section->name, sec_off, names.pn_length);
break;
}
if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE
&& num_debug_info_entries > 0
&& find_debug_info_for_offset (names.pn_offset) == NULL)
- warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"),
- (unsigned long) names.pn_offset, section->name);
+ warn (_(".debug_info offset of %#" PRIx64
+ " in %s section does not point to a CU header.\n"),
+ names.pn_offset, section->name);
SAFE_BYTE_GET_AND_INC (names.pn_size, data, offset_size, start);
- printf (_(" Length: %ld\n"),
- (long) names.pn_length);
+ printf (_(" Length: %" PRId64 "\n"),
+ names.pn_length);
printf (_(" Version: %d\n"),
names.pn_version);
- printf (_(" Offset into .debug_info section: 0x%lx\n"),
- (unsigned long) names.pn_offset);
- printf (_(" Size of area in .debug_info section: %ld\n"),
- (long) names.pn_size);
+ printf (_(" Offset into .debug_info section: 0x%" PRIx64 "\n"),
+ names.pn_offset);
+ printf (_(" Size of area in .debug_info section: %" PRId64 "\n"),
+ names.pn_size);
if (names.pn_version != 2 && names.pn_version != 3)
{
while (1)
{
size_t maxprint;
- dwarf_vma offset;
+ uint64_t offset;
SAFE_BYTE_GET_AND_INC (offset, data, offset_size, start);
kind = GDB_INDEX_SYMBOL_KIND_VALUE (kind_data);
kind_name = get_gdb_index_symbol_kind_name (kind);
is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (kind_data);
- printf (" %-6lx %s,%-10s %.*s\n",
- (unsigned long) offset, is_static ? _("s") : _("g"),
+ printf (" %-6" PRIx64 " %s,%-10s %.*s\n",
+ offset, is_static ? _("s") : _("g"),
kind_name, (int) maxprint, data);
}
else
- printf (" %-6lx\t%.*s\n",
- (unsigned long) offset, (int) maxprint, data);
+ printf (" %-6" PRIx64 "\t%.*s\n",
+ offset, (int) maxprint, data);
data += strnlen ((char *) data, maxprint);
if (data < start)
FILEIDX. Return NULL on failure. */
static unsigned char *
-get_line_filename_and_dirname (dwarf_vma line_offset,
- dwarf_vma fileidx,
+get_line_filename_and_dirname (uint64_t line_offset,
+ uint64_t fileidx,
unsigned char **dir_name)
{
struct dwarf_section *section = &debug_displays [line].section;
unsigned char *hdrptr, *dirtable, *file_name;
unsigned int offset_size;
unsigned int version, opcode_base;
- dwarf_vma length, diridx;
+ uint64_t length, diridx;
const unsigned char * end;
*dir_name = NULL;
unsigned int lineno, version, flags;
unsigned int offset_size;
const unsigned char *string;
- dwarf_vma line_offset = 0, sec_offset = curr - start, offset;
+ uint64_t line_offset = 0, sec_offset = curr - start, offset;
unsigned char **extended_ops = NULL;
SAFE_BYTE_GET_AND_INC (version, curr, 2, end);
SAFE_BYTE_GET_AND_INC (flags, curr, 1, end);
offset_size = (flags & 1) ? 8 : 4;
- printf (_(" Offset: 0x%lx\n"),
- (unsigned long) sec_offset);
+ printf (_(" Offset: 0x%" PRIx64 "\n"), sec_offset);
printf (_(" Version: %d\n"), version);
printf (_(" Offset size: %d\n"), offset_size);
if (flags & 2)
{
SAFE_BYTE_GET_AND_INC (line_offset, curr, offset_size, end);
- printf (_(" Offset into .debug_line: 0x%lx\n"),
- (unsigned long) line_offset);
+ printf (_(" Offset into .debug_line: 0x%" PRIx64 "\n"),
+ line_offset);
}
if (flags & 4)
{
unsigned int i, count, op;
- dwarf_vma nargs, n;
+ uint64_t nargs, n;
SAFE_BYTE_GET_AND_INC (count, curr, 1, end);
case DW_MACRO_import:
SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
- printf (_(" DW_MACRO_import - offset : 0x%lx\n"),
- (unsigned long) offset);
+ printf (_(" DW_MACRO_import - offset : 0x%" PRIx64 "\n"),
+ offset);
break;
case DW_MACRO_define_sup:
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);
+ printf (_(" DW_MACRO_define_sup - lineno : %d"
+ " macro offset : 0x%" PRIx64 "\n"),
+ lineno, offset);
break;
case DW_MACRO_undef_sup:
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);
+ printf (_(" DW_MACRO_undef_sup - lineno : %d"
+ " macro offset : 0x%" PRIx64 "\n"),
+ lineno, offset);
break;
case DW_MACRO_import_sup:
SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
- printf (_(" DW_MACRO_import_sup - offset : 0x%lx\n"),
- (unsigned long) offset);
+ printf (_(" DW_MACRO_import_sup - offset : 0x%" PRIx64 "\n"),
+ offset);
break;
case DW_MACRO_define_strx:
else
printf (" DW_MACRO_undef_strx ");
if (do_wide)
- printf (_("(with offset %s) "), dwarf_vmatoa ("x", offset));
+ printf (_("(with offset %" PRIx64 ") "), offset);
printf (_("lineno : %d macro : %s\n"),
lineno, string);
break;
else
{
/* Skip over unhandled opcodes. */
- dwarf_vma nargs, n;
+ uint64_t nargs, n;
unsigned char *desc = extended_ops[op];
READ_ULEB (nargs, desc, end);
if (nargs == 0)
do
{
- dwarf_vma offset = start - section->start;
+ uint64_t offset = start - section->start;
abbrev_list *list = find_and_process_abbrev_set (section, 0,
section->size, offset,
NULL);
break;
if (list->first_abbrev)
- printf (_(" Number TAG (0x%lx)\n"), (long) offset);
+ printf (_(" Number TAG (0x%" PRIx64 ")\n"), offset);
for (entry = list->first_abbrev; entry; entry = entry->next)
{
get_AT_name (attr->attribute),
get_FORM_name (attr->form));
if (attr->form == DW_FORM_implicit_const)
- printf (": %s", dwarf_vmatoa ("d", attr->implicit_const));
+ printf (": %" PRId64, attr->implicit_const);
putchar ('\n');
}
}
POINTER_SIZE bytes long. */
static bool
-is_max_address (dwarf_vma addr, unsigned int pointer_size)
+is_max_address (uint64_t addr, unsigned int pointer_size)
{
- dwarf_vma mask = ~(~(dwarf_vma) 1 << (pointer_size * 8 - 1));
+ uint64_t mask = ~(~(uint64_t) 0 << 1 << (pointer_size * 8 - 1));
return ((addr & mask) == mask);
}
while (vstart < section_end)
{
- dwarf_vma off = vstart - section->start;
- dwarf_vma vbegin, vend;
+ uint64_t off = vstart - section->start;
+ uint64_t vbegin, vend;
READ_ULEB (vbegin, vstart, section_end);
if (vstart == section_end)
break;
READ_ULEB (vend, vstart, section_end);
- printf (" %8.8lx ", (unsigned long) off);
+ printf (" %8.8" PRIx64 " ", off);
- print_dwarf_view (vbegin, pointer_size, 1);
- print_dwarf_view (vend, pointer_size, 1);
+ print_view (vbegin, pointer_size);
+ print_view (vend, pointer_size);
printf (_("location view pair\n"));
}
display_loc_list (struct dwarf_section *section,
unsigned char **start_ptr,
unsigned int debug_info_entry,
- dwarf_vma offset,
- dwarf_vma base_address,
+ uint64_t offset,
+ uint64_t base_address,
unsigned char **vstart_ptr,
int has_frame_base)
{
unsigned char *start = *start_ptr, *vstart = *vstart_ptr;
unsigned char *section_end = section->start + section->size;
- dwarf_vma cu_offset;
+ uint64_t cu_offset;
unsigned int pointer_size;
unsigned int offset_size;
int dwarf_version;
- dwarf_vma begin;
- dwarf_vma end;
+ uint64_t begin;
+ uint64_t end;
unsigned short length;
int need_frame_base;
while (1)
{
- dwarf_vma off = offset + (start - *start_ptr);
- dwarf_vma vbegin = vm1, vend = vm1;
+ uint64_t off = offset + (start - *start_ptr);
+ uint64_t vbegin = -1, vend = -1;
if (2 * pointer_size > (size_t) (section_end - start))
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
printf (" ");
- print_dwarf_vma (off, 4);
+ print_hex (off, 4);
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, section_end);
SAFE_BYTE_GET_AND_INC (end, start, pointer_size, section_end);
&& !is_max_address (end, pointer_size))
{
base_address = end;
- print_dwarf_vma (begin, pointer_size);
- print_dwarf_vma (end, pointer_size);
+ print_hex (begin, pointer_size);
+ print_hex (end, pointer_size);
printf (_("(base address)\n"));
continue;
}
off = offset + (vstart - *start_ptr);
READ_ULEB (vbegin, vstart, section_end);
- print_dwarf_view (vbegin, pointer_size, 1);
+ print_view (vbegin, pointer_size);
READ_ULEB (vend, vstart, section_end);
- print_dwarf_view (vend, pointer_size, 1);
+ print_view (vend, pointer_size);
- printf (_("views at %8.8lx for:\n %*s "),
- (unsigned long) off, 8, "");
+ printf (_("views at %8.8" PRIx64 " for:\n %*s "), off, 8, "");
}
if (2 > (size_t) (section_end - start))
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
if (length > (size_t) (section_end - start))
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
- print_dwarf_vma (begin + base_address, pointer_size);
- print_dwarf_vma (end + base_address, pointer_size);
+ print_hex (begin + base_address, pointer_size);
+ print_hex (end + base_address, pointer_size);
putchar ('(');
need_frame_base = decode_location_expression (start,
display_loclists_list (struct dwarf_section * section,
unsigned char ** start_ptr,
unsigned int debug_info_entry,
- dwarf_vma offset,
- dwarf_vma base_address,
+ uint64_t offset,
+ uint64_t base_address,
unsigned char ** vstart_ptr,
int has_frame_base)
{
- unsigned char * start = *start_ptr;
- unsigned char * vstart = *vstart_ptr;
- unsigned char * section_end = section->start + section->size;
- dwarf_vma cu_offset;
- unsigned int pointer_size;
- unsigned int offset_size;
- unsigned int dwarf_version;
+ unsigned char *start = *start_ptr;
+ unsigned char *vstart = *vstart_ptr;
+ unsigned char *section_end = section->start + section->size;
+ uint64_t cu_offset;
+ unsigned int pointer_size;
+ unsigned int offset_size;
+ unsigned int dwarf_version;
/* Initialize it due to a false compiler warning. */
- dwarf_vma begin = -1, vbegin = -1;
- dwarf_vma end = -1, vend = -1;
- dwarf_vma length;
+ uint64_t begin = -1, vbegin = -1;
+ uint64_t end = -1, vend = -1;
+ uint64_t length;
int need_frame_base;
if (debug_info_entry >= num_debug_info_entries)
while (1)
{
- dwarf_vma off = offset + (start - *start_ptr);
+ uint64_t off = offset + (start - *start_ptr);
enum dwarf_location_list_entry_type llet;
if (start + 1 > section_end)
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
printf (" ");
- print_dwarf_vma (off, 4);
+ print_hex (off, 4);
SAFE_BYTE_GET_AND_INC (llet, start, 1, section_end);
off = offset + (vstart - *start_ptr);
READ_ULEB (vbegin, vstart, section_end);
- print_dwarf_view (vbegin, pointer_size, 1);
+ print_view (vbegin, pointer_size);
READ_ULEB (vend, vstart, section_end);
- print_dwarf_view (vend, pointer_size, 1);
+ print_view (vend, pointer_size);
- printf (_("views at %8.8lx for:\n %*s "),
- (unsigned long) off, 8, "");
+ printf (_("views at %8.8" PRIx64 " for:\n %*s "), off, 8, "");
}
switch (llet)
case DW_LLE_base_addressx:
READ_ULEB (base_address, start, section_end);
- print_dwarf_vma (base_address, pointer_size);
+ print_hex (base_address, pointer_size);
printf (_("(index into .debug_addr) "));
base_address = fetch_indexed_addr (base_address, pointer_size);
- print_dwarf_vma (base_address, pointer_size);
+ print_hex (base_address, pointer_size);
printf (_("(base address)\n"));
break;
case DW_LLE_base_address:
SAFE_BYTE_GET_AND_INC (base_address, start, pointer_size,
section_end);
- print_dwarf_vma (base_address, pointer_size);
+ print_hex (base_address, pointer_size);
printf (_("(base address)\n"));
break;
if (vstart)
printf (_("View pair entry in loclist with locviews attribute\n"));
READ_ULEB (vbegin, start, section_end);
- print_dwarf_view (vbegin, pointer_size, 1);
+ print_view (vbegin, pointer_size);
READ_ULEB (vend, start, section_end);
- print_dwarf_view (vend, pointer_size, 1);
+ print_view (vend, pointer_size);
printf (_("views for:\n"));
continue;
if (start == section_end)
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
READ_ULEB (length, start, section_end);
if (length > (size_t) (section_end - start))
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
- print_dwarf_vma (begin, pointer_size);
- print_dwarf_vma (end, pointer_size);
+ print_hex (begin, pointer_size);
+ print_hex (end, pointer_size);
putchar ('(');
need_frame_base = decode_location_expression (start,
vbegin = vend = -1;
}
- if (vbegin != vm1 || vend != vm1)
+ if (vbegin != (uint64_t) -1 || vend != (uint64_t) -1)
printf (_("Trailing view pair not used in a range"));
*start_ptr = start;
display_loc_list_dwo (struct dwarf_section *section,
unsigned char **start_ptr,
unsigned int debug_info_entry,
- dwarf_vma offset,
+ uint64_t offset,
unsigned char **vstart_ptr,
int has_frame_base)
{
unsigned char *start = *start_ptr, *vstart = *vstart_ptr;
unsigned char *section_end = section->start + section->size;
- dwarf_vma cu_offset;
+ uint64_t cu_offset;
unsigned int pointer_size;
unsigned int offset_size;
int dwarf_version;
while (1)
{
printf (" ");
- print_dwarf_vma (offset + (start - *start_ptr), 4);
+ print_hex (offset + (start - *start_ptr), 4);
if (start >= section_end)
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
case 3:
case 4:
{
- dwarf_vma view;
- dwarf_vma off = offset + (vstart - *start_ptr);
+ uint64_t view;
+ uint64_t off = offset + (vstart - *start_ptr);
READ_ULEB (view, vstart, section_end);
- print_dwarf_view (view, 8, 1);
+ print_view (view, 8);
READ_ULEB (view, vstart, section_end);
- print_dwarf_view (view, 8, 1);
+ print_view (view, 8);
- printf (_("views at %8.8lx for:\n %*s "),
- (unsigned long) off, 8, "");
+ printf (_("views at %8.8" PRIx64 " for:\n %*s "), off, 8, "");
}
break;
if (2 > (size_t) (section_end - start))
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
SAFE_BYTE_GET_AND_INC (length, start, 2, section_end);
if (length > (size_t) (section_end - start))
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) offset);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
/* Sort array of indexes in ascending order of loc_offsets[idx] and
loc_views. */
-static dwarf_vma *loc_offsets, *loc_views;
+static uint64_t *loc_offsets, *loc_views;
static int
loc_offsets_compar (const void *ap, const void *bp)
{
- dwarf_vma a = loc_offsets[*(const unsigned int *) ap];
- dwarf_vma b = loc_offsets[*(const unsigned int *) bp];
+ uint64_t a = loc_offsets[*(const unsigned int *) ap];
+ uint64_t b = loc_offsets[*(const unsigned int *) bp];
int ret = (a > b) - (b > a);
if (ret)
do
{
- dwarf_vma length;
- unsigned short version;
- unsigned char address_size;
- unsigned char segment_selector_size;
- uint32_t offset_entry_count;
- uint32_t i;
- bool is_64bit;
+ uint64_t length;
+ unsigned short version;
+ unsigned char address_size;
+ unsigned char segment_selector_size;
+ uint32_t offset_entry_count;
+ uint32_t i;
+ bool is_64bit;
- printf (_("Table at Offset 0x%lx\n"), (long)(start - section->start));
+ printf (_("Table at Offset 0x%tx\n"), start - section->start);
SAFE_BYTE_GET_AND_INC (length, start, 4, end);
if (length == 0xffffffff)
SAFE_BYTE_GET_AND_INC (segment_selector_size, start, 1, end);
SAFE_BYTE_GET_AND_INC (offset_entry_count, start, 4, end);
- printf (_(" Length: 0x%s\n"), dwarf_vmatoa ("x", length));
+ printf (_(" Length: 0x%" PRIx64 "\n"), length);
printf (_(" DWARF version: %u\n"), version);
printf (_(" Address size: %u\n"), address_size);
printf (_(" Segment size: %u\n"), segment_selector_size);
return 0;
}
- printf (_("\n Offset Entries starting at 0x%lx:\n"),
- (long)(start - section->start));
-
- if (is_64bit)
- {
- for (i = 0; i < offset_entry_count; i++)
- {
- dwarf_vma entry;
+ printf (_("\n Offset Entries starting at 0x%tx:\n"),
+ start - section->start);
- SAFE_BYTE_GET_AND_INC (entry, start, 8, end);
- printf (_(" [%6u] 0x%s\n"), i, dwarf_vmatoa ("x", entry));
- }
- }
- else
+ for (i = 0; i < offset_entry_count; i++)
{
- for (i = 0; i < offset_entry_count; i++)
- {
- uint32_t entry;
+ uint64_t entry;
- SAFE_BYTE_GET_AND_INC (entry, start, 4, end);
- printf (_(" [%6u] 0x%x\n"), i, entry);
- }
+ SAFE_BYTE_GET_AND_INC (entry, start, is_64bit ? 8 : 4, end);
+ printf (_(" [%6u] 0x%" PRIx64 "\n"), i, entry);
}
putchar ('\n');
for (j = 1, i = 0; i < offset_entry_count;)
{
- unsigned char lle;
- dwarf_vma base_address = 0;
- dwarf_vma begin;
- dwarf_vma finish;
- dwarf_vma off = start - section->start;
+ unsigned char lle;
+ uint64_t base_address = 0;
+ uint64_t begin;
+ uint64_t finish;
+ uint64_t off = start - section->start;
if (j != i)
{
}
printf (" ");
- print_dwarf_vma (off, 4);
+ print_hex (off, 4);
SAFE_BYTE_GET_AND_INC (lle, start, 1, end);
case DW_LLE_base_addressx:
READ_ULEB (base_address, start, end);
- print_dwarf_vma (base_address, address_size);
+ print_hex (base_address, address_size);
printf (_("(index into .debug_addr) "));
base_address = fetch_indexed_addr (base_address, address_size);
- print_dwarf_vma (base_address, address_size);
+ print_hex (base_address, address_size);
printf (_("(base address)\n"));
continue;
case DW_LLE_base_address:
SAFE_BYTE_GET_AND_INC (base_address, start, address_size, end);
- print_dwarf_vma (base_address, address_size);
+ print_hex (base_address, address_size);
printf (_("(base address)\n"));
continue;
if (start == end)
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) off);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), off);
break;
}
- print_dwarf_vma (begin, address_size);
- print_dwarf_vma (finish, address_size);
+ print_hex (begin, address_size);
+ print_hex (finish, address_size);
if (begin == finish)
- fputs (_(" (start == end)"), stdout);
+ fputs (_("(start == end)"), stdout);
else if (begin > finish)
- fputs (_(" (start > end)"), stdout);
+ fputs (_("(start > end)"), stdout);
/* Read the counted location descriptions. */
READ_ULEB (length, start, end);
if (length > (size_t) (end - start))
{
- warn (_("Location list starting at offset 0x%lx is not terminated.\n"),
- (unsigned long) off);
+ warn (_("Location list starting at offset %#" PRIx64
+ " is not terminated.\n"), off);
break;
}
- putchar (' ');
(void) decode_location_expression (start, address_size, address_size,
version, length, 0, section);
start += length;
display_debug_loc (struct dwarf_section *section, void *file)
{
unsigned char *start = section->start, *vstart = NULL;
- dwarf_vma bytes;
+ uint64_t bytes;
unsigned char *section_begin = start;
unsigned int num_loc_list = 0;
- dwarf_vma last_offset = 0;
- dwarf_vma last_view = 0;
+ uint64_t last_offset = 0;
+ uint64_t last_view = 0;
unsigned int first = 0;
unsigned int i;
unsigned int j;
const char *suffix = strrchr (section->name, '.');
bool is_dwo = false;
int is_loclists = strstr (section->name, "debug_loclists") != NULL;
- dwarf_vma expected_start = 0;
+ uint64_t expected_start = 0;
if (suffix && strcmp (suffix, ".dwo") == 0)
is_dwo = true;
if (is_loclists)
{
unsigned char *hdrptr = section_begin;
- dwarf_vma ll_length;
+ uint64_t ll_length;
unsigned short ll_version;
unsigned char *end = section_begin + section->size;
unsigned char address_size, segment_selector_size;
if (debug_information [first].num_loc_offsets > 0
&& debug_information [first].loc_offsets [0] != expected_start
&& debug_information [first].loc_views [0] != expected_start)
- warn (_("Location lists in %s section start at 0x%s rather than 0x%s\n"),
- section->name,
- dwarf_vmatoa ("x", debug_information [first].loc_offsets [0]),
- dwarf_vmatoa ("x", expected_start));
+ warn (_("Location lists in %s section start at %#" PRIx64
+ " rather than %#" PRIx64 "\n"),
+ section->name, debug_information [first].loc_offsets [0],
+ expected_start);
if (!locs_sorted)
array = (unsigned int *) xcmalloc (num_loc_list, sizeof (unsigned int));
seen_first_offset = 0;
for (i = first; i < num_debug_info_entries; i++)
{
- dwarf_vma offset, voffset;
- dwarf_vma base_address;
+ uint64_t offset, voffset;
+ uint64_t base_address;
unsigned int k;
int has_frame_base;
offset = debug_information [i].loc_offsets [j];
next = section_begin + offset;
voffset = debug_information [i].loc_views [j];
- if (voffset != vm1)
+ if (voffset != (uint64_t) -1)
vnext = section_begin + voffset;
else
vnext = NULL;
else
{
if (start < next)
- warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"),
- (unsigned long) (start - section_begin),
- (unsigned long) offset,
- section->name);
+ warn (_("There is a hole [%#tx - %#" PRIx64 "]"
+ " in %s section.\n"),
+ start - section_begin, offset, section->name);
else if (start > next)
- warn (_("There is an overlap [0x%lx - 0x%lx] in %s section.\n"),
- (unsigned long) (start - section_begin),
- (unsigned long) offset,
- section->name);
+ warn (_("There is an overlap [%#tx - %#" PRIx64 "]"
+ " in %s section.\n"),
+ start - section_begin, offset, section->name);
}
start = next;
vstart = vnext;
if (offset >= bytes)
{
- warn (_("Offset 0x%lx is bigger than %s section size.\n"),
- (unsigned long) offset,
- section->name);
+ warn (_("Offset %#" PRIx64 " is bigger than %s section size.\n"),
+ offset, section->name);
continue;
}
if (vnext && voffset >= bytes)
{
- warn (_("View Offset 0x%lx is bigger than %s section size.\n"),
- (unsigned long) voffset,
- section->name);
+ warn (_("View Offset %#" PRIx64 " is bigger than %s section size.\n"),
+ voffset, section->name);
continue;
}
void *file ATTRIBUTE_UNUSED)
{
unsigned char *start = section->start;
- dwarf_vma bytes = section->size;
- dwarf_vma addr = section->address;
+ uint64_t bytes = section->size;
+ uint64_t addr = section->address;
if (bytes == 0)
{
lbytes = (bytes > 16 ? 16 : bytes);
- printf (" 0x%8.8lx ", (unsigned long) addr);
+ printf (" 0x%8.8" PRIx64 " ", addr);
for (j = 0; j < 16; j++)
{
unsigned char *hdrptr;
DWARF2_Internal_ARange arange;
unsigned char *addr_ranges;
- dwarf_vma length;
- dwarf_vma address;
- dwarf_vma sec_off;
+ uint64_t length;
+ uint64_t address;
+ uint64_t sec_off;
unsigned char address_size;
- unsigned int offset_size;
+ unsigned int offset_size;
unsigned char *end_ranges;
hdrptr = start;
if (arange.ar_length > (size_t) (end - hdrptr))
{
- warn (_("Debug info is corrupted, %s header at %#lx has length %s\n"),
- section->name,
- (unsigned long) sec_off,
- dwarf_vmatoa ("x", arange.ar_length));
+ warn (_("Debug info is corrupted, %s header at %#" PRIx64
+ " has length %#" PRIx64 "\n"),
+ section->name, sec_off, arange.ar_length);
break;
}
end_ranges = hdrptr + arange.ar_length;
if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE
&& num_debug_info_entries > 0
&& find_debug_info_for_offset (arange.ar_info_offset) == NULL)
- warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"),
- (unsigned long) arange.ar_info_offset, section->name);
+ warn (_(".debug_info offset of %#" PRIx64
+ " in %s section does not point to a CU header.\n"),
+ arange.ar_info_offset, section->name);
SAFE_BYTE_GET_AND_INC (arange.ar_pointer_size, hdrptr, 1, end_ranges);
SAFE_BYTE_GET_AND_INC (arange.ar_segment_size, hdrptr, 1, end_ranges);
break;
}
- printf (_(" Length: %ld\n"),
- (long) arange.ar_length);
+ printf (_(" Length: %" PRId64 "\n"), arange.ar_length);
printf (_(" Version: %d\n"), arange.ar_version);
- printf (_(" Offset into .debug_info: 0x%lx\n"),
- (unsigned long) arange.ar_info_offset);
+ printf (_(" Offset into .debug_info: 0x%" PRIx64 "\n"),
+ arange.ar_info_offset);
printf (_(" Pointer Size: %d\n"), arange.ar_pointer_size);
printf (_(" Segment Size: %d\n"), arange.ar_segment_size);
SAFE_BYTE_GET_AND_INC (length, addr_ranges, address_size,
end_ranges);
printf (" ");
- print_dwarf_vma (address, address_size);
- print_dwarf_vma (length, address_size);
+ print_hex (address, address_size);
+ print_hex (length, address_size);
putchar ('\n');
}
{
/* PR 17531: file: cf38d01b. */
if (debug_information[i].addr_base >= section->size)
- warn (_("Corrupt address base (%lx) found in debug section %u\n"),
- (unsigned long) debug_information[i].addr_base, i);
+ warn (_("Corrupt address base (%#" PRIx64 ")"
+ " found in debug section %u\n"),
+ debug_information[i].addr_base, i);
else
debug_addr_info [count++] = debug_information + i;
}
unsigned int idx;
unsigned int address_size = debug_addr_info [i]->pointer_size;
- printf (_(" For compilation unit at offset 0x%s:\n"),
- dwarf_vmatoa ("x", debug_addr_info [i]->cu_offset));
+ printf (_(" For compilation unit at offset 0x%" PRIx64 ":\n"),
+ debug_addr_info [i]->cu_offset);
printf (_("\tIndex\tAddress\n"));
entry = section->start + debug_addr_info [i]->addr_base;
if (debug_addr_info [i]->dwarf_version >= 5)
{
- size_t header_size = entry - header;
- unsigned char * curr_header = header;
- dwarf_vma length;
- int version;
- int segment_selector_size;
+ size_t header_size = entry - header;
+ unsigned char *curr_header = header;
+ uint64_t length;
+ int version;
+ int segment_selector_size;
if (header_size != 8 && header_size != 16)
{
- warn (_("Corrupt %s section: expecting header size of 8 or 16, but found %ld instead\n"),
- section->name, (long) header_size);
+ warn (_("Corrupt %s section: expecting header size of 8 or 16, but found %zd instead\n"),
+ section->name, header_size);
return 0;
}
idx = 0;
while (entry < end)
{
- dwarf_vma base = byte_get (entry, address_size);
+ uint64_t base = byte_get (entry, address_size);
printf (_("\t%d:\t"), idx);
- print_dwarf_vma (base, address_size);
+ print_hex (base, address_size);
printf ("\n");
entry += address_size;
idx++;
unsigned char *start = section->start;
unsigned char *end = start + section->size;
unsigned char *curr = start;
- dwarf_vma debug_str_offsets_hdr_len;
+ uint64_t debug_str_offsets_hdr_len;
const char *suffix = strrchr (section->name, '.');
bool dwo = suffix && strcmp (suffix, ".dwo") == 0;
while (curr < end)
{
- dwarf_vma length;
- dwarf_vma entry_length;
+ uint64_t length;
+ uint64_t entry_length;
SAFE_BYTE_GET_AND_INC (length, curr, 4, end);
/* FIXME: We assume that this means 64-bit DWARF is being used. */
curr = section->start;
entries_end = end;
- printf (_(" Length: %#lx\n"), (unsigned long) length);
+ printf (_(" Length: %#" PRIx64 "\n"), length);
printf (_(" Index Offset [String]\n"));
}
else
{
- if (length <= (dwarf_vma) (end - curr))
+ if (length <= (size_t) (end - curr))
entries_end = curr + length;
else
{
- warn (_("Section %s is too small %#lx\n"),
- section->name, (unsigned long) section->size);
+ warn (_("Section %s is too small %#" PRIx64 "\n"),
+ section->name, section->size);
entries_end = end;
}
if (padding != 0)
warn (_("Unexpected value in str_offset header's padding field: %#x\n"), padding);
- printf (_(" Length: %#lx\n"), (unsigned long) length);
- printf (_(" Version: %#lx\n"), (unsigned long) version);
+ printf (_(" Length: %#" PRIx64 "\n"), length);
+ printf (_(" Version: %#x\n"), version);
printf (_(" Index Offset [String]\n"));
}
for (idx = 0; curr < entries_end; idx++)
{
- dwarf_vma offset;
+ uint64_t offset;
const unsigned char * string;
- if ((dwarf_vma) (entries_end - curr) < entry_length)
+ if ((size_t) (entries_end - curr) < entry_length)
/* Not enough space to read one entry_length, give up. */
return 0;
else
string = fetch_indirect_string (offset);
- printf (" %8lu %8s %s\n", idx, dwarf_vmatoa ("x", offset),
- string);
+ printf (" %8lu ", idx);
+ print_hex (offset, entry_length);
+ printf (" %s\n", string);
}
}
struct range_entry
{
/* The debug_information[x].range_lists[y] value. */
- dwarf_vma ranges_offset;
+ uint64_t ranges_offset;
/* Original debug_information to find parameters of the data. */
debug_info *debug_info_p;
{
const struct range_entry *a_re = (const struct range_entry *) ap;
const struct range_entry *b_re = (const struct range_entry *) bp;
- const dwarf_vma a = a_re->ranges_offset;
- const dwarf_vma b = b_re->ranges_offset;
+ const uint64_t a = a_re->ranges_offset;
+ const uint64_t b = b_re->ranges_offset;
return (a > b) - (b > a);
}
display_debug_ranges_list (unsigned char * start,
unsigned char * finish,
unsigned int pointer_size,
- dwarf_vma offset,
- dwarf_vma base_address)
+ uint64_t offset,
+ uint64_t base_address)
{
while (start < finish)
{
- dwarf_vma begin;
- dwarf_vma end;
+ uint64_t begin;
+ uint64_t end;
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, finish);
if (start >= finish)
SAFE_SIGNED_BYTE_GET_AND_INC (end, start, pointer_size, finish);
printf (" ");
- print_dwarf_vma (offset, 4);
+ print_hex (offset, 4);
if (begin == 0 && end == 0)
{
&& !is_max_address (end, pointer_size))
{
base_address = end;
- print_dwarf_vma (begin, pointer_size);
- print_dwarf_vma (end, pointer_size);
+ print_hex (begin, pointer_size);
+ print_hex (end, pointer_size);
printf ("(base address)\n");
continue;
}
- print_dwarf_vma (begin + base_address, pointer_size);
- print_dwarf_vma (end + base_address, pointer_size);
+ print_hex (begin + base_address, pointer_size);
+ print_hex (end + base_address, pointer_size);
if (begin == end)
fputs (_("(start == end)"), stdout);
display_debug_rnglists_list (unsigned char * start,
unsigned char * finish,
unsigned int pointer_size,
- dwarf_vma offset,
- dwarf_vma base_address,
+ uint64_t offset,
+ uint64_t base_address,
unsigned int offset_size)
{
unsigned char *next = start;
while (1)
{
- dwarf_vma off = offset + (start - next);
+ uint64_t off = offset + (start - next);
enum dwarf_range_list_entry rlet;
/* Initialize it due to a false compiler warning. */
- dwarf_vma begin = -1, length, end = -1;
+ uint64_t begin = -1, length, end = -1;
if (start >= finish)
{
- warn (_("Range list starting at offset 0x%s is not terminated.\n"),
- dwarf_vmatoa ("x", offset));
+ warn (_("Range list starting at offset %#" PRIx64
+ " is not terminated.\n"), offset);
break;
}
printf (" ");
- print_dwarf_vma (off, 4);
+ print_hex (off, 4);
SAFE_BYTE_GET_AND_INC (rlet, start, 1, finish);
break;
case DW_RLE_base_addressx:
READ_ULEB (base_address, start, finish);
- print_dwarf_vma (base_address, pointer_size);
+ print_hex (base_address, pointer_size);
printf (_("(base address index) "));
base_address = fetch_indexed_addr ((base_address * pointer_size)
+ debug_addr_section_hdr_len, pointer_size);
- print_dwarf_vma (base_address, pointer_size);
+ print_hex (base_address, pointer_size);
printf (_("(base address)\n"));
break;
case DW_RLE_startx_endx:
break;
case DW_RLE_base_address:
SAFE_BYTE_GET_AND_INC (base_address, start, pointer_size, finish);
- print_dwarf_vma (base_address, pointer_size);
+ print_hex (base_address, pointer_size);
printf (_("(base address)\n"));
break;
case DW_RLE_start_end:
end += base_address;
}
- print_dwarf_vma (begin, pointer_size);
- print_dwarf_vma (end, pointer_size);
+ print_hex (begin, pointer_size);
+ print_hex (end, pointer_size);
if (begin == end)
- fputs (_("(start == end)"), stdout);
+ fputs (_(" (start == end)"), stdout);
else if (begin > end)
- fputs (_("(start > end)"), stdout);
+ fputs (_(" (start > end)"), stdout);
putchar ('\n');
}
static int
display_debug_rnglists (struct dwarf_section *section)
{
- unsigned char * start = section->start;
- unsigned char * finish = start + section->size;
+ unsigned char *start = section->start;
+ unsigned char *finish = start + section->size;
while (start < finish)
{
- unsigned char * table_start;
- dwarf_vma offset = start - section->start;
- unsigned char * end;
- dwarf_vma initial_length;
- unsigned char segment_selector_size;
- unsigned int offset_entry_count;
- unsigned int i;
- unsigned short version;
- unsigned char address_size = 0;
- unsigned char offset_size;
+ unsigned char *table_start;
+ uint64_t offset = start - section->start;
+ unsigned char *end;
+ uint64_t initial_length;
+ unsigned char segment_selector_size;
+ unsigned int offset_entry_count;
+ unsigned int i;
+ unsigned short version;
+ unsigned char address_size = 0;
+ unsigned char offset_size;
/* Get and check the length of the block. */
SAFE_BYTE_GET_AND_INC (initial_length, start, 4, finish);
initial_length = finish - start;
else
{
- warn (_("The length field (0x%lx) in the debug_rnglists header is wrong - the section is too small\n"),
- (long) initial_length);
+ warn (_("The length field (%#" PRIx64
+ ") in the debug_rnglists header is wrong"
+ " - the section is too small\n"),
+ initial_length);
return 0;
}
}
SAFE_BYTE_GET_AND_INC (segment_selector_size, start, 1, finish);
SAFE_BYTE_GET_AND_INC (offset_entry_count, start, 4, finish);
- printf (_(" Table at Offset: 0x%s:\n"), dwarf_vmatoa ("x", offset));
- printf (_(" Length: 0x%s\n"), dwarf_vmatoa ("x", initial_length));
+ printf (_(" Table at Offset: 0x%" PRIx64 ":\n"), offset);
+ printf (_(" Length: 0x%" PRIx64 "\n"), initial_length);
printf (_(" DWARF version: %u\n"), version);
printf (_(" Address size: %u\n"), address_size);
printf (_(" Segment size: %u\n"), segment_selector_size);
if (offset_entry_count != 0)
{
- printf (_("\n Offsets starting at 0x%lx:\n"), (long)(start - section->start));
- if (offset_size == 8)
- {
- for (i = 0; i < offset_entry_count; i++)
- {
- dwarf_vma entry;
+ printf (_("\n Offsets starting at 0x%tx:\n"),
+ start - section->start);
- SAFE_BYTE_GET_AND_INC (entry, start, 8, finish);
- printf (_(" [%6u] 0x%s\n"), i, dwarf_vmatoa ("x", entry));
- }
- }
- else
+ for (i = 0; i < offset_entry_count; i++)
{
- for (i = 0; i < offset_entry_count; i++)
- {
- uint32_t entry;
+ uint64_t entry;
- SAFE_BYTE_GET_AND_INC (entry, start, 4, finish);
- printf (_(" [%6u] 0x%x\n"), i, entry);
- }
+ SAFE_BYTE_GET_AND_INC (entry, start, offset_size, finish);
+ printf (_(" [%6u] 0x%" PRIx64 "\n"), i, entry);
}
}
else
for (i = 0; i < offset_entry_count; i++)
{
- dwarf_vma indx = start - table_start;
+ uint64_t indx = start - table_start;
offset = start - section->start;
- printf (_("\n Offset: %lx, Index: 0x%s\n"),
- (long) offset, dwarf_vmatoa ("x", indx));
+ printf (_("\n Offset: %" PRIx64 ", Index: 0x%" PRIx64 "\n"),
+ offset, indx);
printf (_(" Offset Begin End\n"));
start = display_debug_rnglists_list
(start, end, address_size, offset, 0, offset_size);
display_debug_ranges (struct dwarf_section *section,
void *file ATTRIBUTE_UNUSED)
{
- unsigned char * start = section->start;
- unsigned char * last_start = start;
- dwarf_vma bytes = section->size;
- unsigned char * section_begin = start;
- unsigned char * finish = start + bytes;
- unsigned int num_range_list, i;
- struct range_entry * range_entries;
- struct range_entry * range_entry_fill;
- int is_rnglists = strstr (section->name, "debug_rnglists") != NULL;
+ unsigned char *start = section->start;
+ unsigned char *last_start = start;
+ uint64_t bytes = section->size;
+ unsigned char *section_begin = start;
+ unsigned char *finish = start + bytes;
+ unsigned int num_range_list, i;
+ struct range_entry *range_entries;
+ struct range_entry *range_entry_fill;
+ int is_rnglists = strstr (section->name, "debug_rnglists") != NULL;
/* Initialize it due to a false compiler warning. */
- unsigned char address_size = 0;
- dwarf_vma last_offset = 0;
+ unsigned char address_size = 0;
+ uint64_t last_offset = 0;
if (bytes == 0)
{
range_entry_compar);
if (dwarf_check != 0 && range_entries[0].ranges_offset != 0)
- warn (_("Range lists in %s section start at 0x%lx\n"),
- section->name, (unsigned long) range_entries[0].ranges_offset);
+ warn (_("Range lists in %s section start at %#" PRIx64 "\n"),
+ section->name, range_entries[0].ranges_offset);
putchar ('\n');
printf (_(" Offset Begin End\n"));
struct range_entry *range_entry = &range_entries[i];
debug_info *debug_info_p = range_entry->debug_info_p;
unsigned int pointer_size;
- dwarf_vma offset;
+ uint64_t offset;
unsigned char *next;
- dwarf_vma base_address;
+ uint64_t base_address;
pointer_size = (is_rnglists ? address_size : debug_info_p->pointer_size);
offset = range_entry->ranges_offset;
/* PR 17512: file: 001-101485-0.001:0.1. */
if (pointer_size < 2 || pointer_size > 8)
{
- warn (_("Corrupt pointer size (%d) in debug entry at offset %8.8lx\n"),
- pointer_size, (unsigned long) offset);
+ warn (_("Corrupt pointer size (%d) in debug entry at offset %#" PRIx64 "\n"),
+ pointer_size, offset);
continue;
}
if (offset > (size_t) (finish - section_begin))
{
- warn (_("Corrupt offset (%#8.8lx) in range entry %u\n"),
- (unsigned long) offset, i);
+ warn (_("Corrupt offset (%#" PRIx64 ") in range entry %u\n"),
+ offset, i);
continue;
}
if (dwarf_check != 0 && i > 0)
{
if (start < next)
- warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"),
- (unsigned long) (start - section_begin),
- (unsigned long) (next - section_begin), section->name);
+ warn (_("There is a hole [%#tx - %#tx] in %s section.\n"),
+ start - section_begin, next - section_begin, section->name);
else if (start > next)
{
if (next == last_start)
continue;
- warn (_("There is an overlap [0x%lx - 0x%lx] in %s section.\n"),
- (unsigned long) (start - section_begin),
- (unsigned long) (next - section_begin), section->name);
+ warn (_("There is an overlap [%#tx - %#tx] in %s section.\n"),
+ start - section_begin, next - section_begin, section->name);
}
}
char *augmentation;
unsigned int code_factor;
int data_factor;
- dwarf_vma pc_begin;
- dwarf_vma pc_range;
+ uint64_t pc_begin;
+ uint64_t pc_range;
unsigned int cfa_reg;
- dwarf_vma cfa_offset;
+ uint64_t cfa_offset;
unsigned int ra;
unsigned char fde_encoding;
unsigned char cfa_exp;
printf ("\n");
}
- print_dwarf_vma (fc->pc_begin, eh_addr_size);
+ print_hex (fc->pc_begin, eh_addr_size);
if (fc->cfa_exp)
strcpy (tmp, "exp");
else
static unsigned char *
read_cie (unsigned char *start, unsigned char *end,
Frame_Chunk **p_cie, int *p_version,
- dwarf_size_type *p_aug_len, unsigned char **p_aug)
+ uint64_t *p_aug_len, unsigned char **p_aug)
{
int version;
Frame_Chunk *fc;
unsigned char *augmentation_data = NULL;
- dwarf_size_type augmentation_data_len = 0;
+ uint64_t augmentation_data_len = 0;
* p_cie = NULL;
/* PR 17512: file: 001-228113-0.004. */
/* PR 17512: file: 11042-2589-0.004. */
if (augmentation_data_len > (size_t) (end - start))
{
- warn (_("Augmentation data too long: 0x%s, expected at most %#lx\n"),
- dwarf_vmatoa ("x", augmentation_data_len),
- (unsigned long) (end - start));
+ warn (_("Augmentation data too long: %#" PRIx64
+ ", expected at most %#tx\n"),
+ augmentation_data_len, end - start);
goto fail;
}
start += augmentation_data_len;
If do_wide is not enabled, then formats the output to fit into 80 columns. */
static void
-display_augmentation_data (const unsigned char * data, dwarf_size_type len)
+display_augmentation_data (const unsigned char * data, uint64_t len)
{
size_t i;
{
unsigned char *saved_start;
unsigned char *block_end;
- dwarf_vma length;
- dwarf_vma cie_id;
+ uint64_t length;
+ uint64_t cie_id;
Frame_Chunk *fc;
Frame_Chunk *cie;
int need_col_headers = 1;
unsigned char *augmentation_data = NULL;
- dwarf_size_type augmentation_data_len = 0;
+ uint64_t augmentation_data_len = 0;
unsigned int encoded_ptr_size = saved_eh_addr_size;
unsigned int offset_size;
bool all_nops;
if (length == 0)
{
- printf ("\n%08lx ZERO terminator\n\n",
- (unsigned long)(saved_start - section_start));
+ printf ("\n%08tx ZERO terminator\n\n",
+ saved_start - section_start);
/* Skip any zero terminators that directly follow.
A corrupt section size could have loaded a whole
slew of zero filled memory bytes. eg
if (length > (size_t) (end - start))
{
- warn ("Invalid length 0x%s in FDE at %#08lx\n",
- dwarf_vmatoa_1 (NULL, length, offset_size),
- (unsigned long) (saved_start - section_start));
+ warn ("Invalid length %#" PRIx64 " in FDE at %#tx\n",
+ length, saved_start - section_start);
block_end = end;
}
else
if (fc->fde_encoding)
encoded_ptr_size = size_of_encoded_value (fc->fde_encoding);
- printf ("\n%08lx ", (unsigned long) (saved_start - section_start));
- print_dwarf_vma (length, fc->ptr_size);
- print_dwarf_vma (cie_id, offset_size);
+ printf ("\n%08tx ", saved_start - section_start);
+ print_hex (length, fc->ptr_size);
+ print_hex (cie_id, offset_size);
if (do_debug_frames_interp)
{
{
unsigned char *look_for;
unsigned long segment_selector;
- dwarf_vma cie_off;
+ uint64_t cie_off;
cie_off = cie_id;
if (is_eh)
{
- dwarf_vma sign = (dwarf_vma) 1 << (offset_size * 8 - 1);
+ uint64_t sign = (uint64_t) 1 << (offset_size * 8 - 1);
cie_off = (cie_off ^ sign) - sign;
cie_off = start - 4 - section_start - cie_off;
}
look_for = section_start + cie_off;
- if (cie_off <= (dwarf_vma) (saved_start - section_start))
+ if (cie_off <= (size_t) (saved_start - section_start))
{
for (cie = chunks; cie ; cie = cie->next)
if (cie->chunk_start == look_for)
}
if (length != 0 && length <= (size_t) (end - cie_scan))
{
- dwarf_vma c_id;
+ uint64_t c_id;
unsigned char *cie_end = cie_scan + length;
SAFE_BYTE_GET_AND_INC (c_id, cie_scan, off_size,
/* PR 17512 file: 722-8446-0.004 and PR 22386. */
if (augmentation_data_len > (size_t) (block_end - start))
{
- warn (_("Augmentation data too long: 0x%s, "
- "expected at most %#lx\n"),
- dwarf_vmatoa ("x", augmentation_data_len),
- (unsigned long) (block_end - start));
+ warn (_("Augmentation data too long: %#" PRIx64 ", "
+ "expected at most %#tx\n"),
+ augmentation_data_len, block_end - start);
start = block_end;
augmentation_data = NULL;
augmentation_data_len = 0;
start += augmentation_data_len;
}
- printf ("\n%08lx %s %s FDE ",
- (unsigned long)(saved_start - section_start),
- dwarf_vmatoa_1 (NULL, length, fc->ptr_size),
- dwarf_vmatoa_1 (NULL, cie_id, offset_size));
+ printf ("\n%08tx ", saved_start - section_start);
+ print_hex (length, fc->ptr_size);
+ print_hex (cie_id, offset_size);
+ printf ("FDE ");
if (cie->chunk_start)
- printf ("cie=%08lx",
- (unsigned long) (cie->chunk_start - section_start));
+ printf ("cie=%08tx", cie->chunk_start - section_start);
else
/* Ideally translate "invalid " to 8 chars, trailing space
is optional. */
if (fc->segment_size)
printf ("%04lx:", segment_selector);
- printf ("%s..%s\n",
- dwarf_vmatoa_1 (NULL, fc->pc_begin, fc->ptr_size),
- dwarf_vmatoa_1 (NULL, fc->pc_begin + fc->pc_range, fc->ptr_size));
+ print_hex_ns (fc->pc_begin, fc->ptr_size);
+ printf ("..");
+ print_hex_ns (fc->pc_begin + fc->pc_range, fc->ptr_size);
+ printf ("\n");
if (! do_debug_frames_interp && augmentation_data_len)
{
are various functions, notably frame_space_needed() that assume that
reg is an unsigned int. */
unsigned int reg;
- dwarf_signed_vma l;
- dwarf_vma ofs;
- dwarf_vma vma;
+ int64_t l;
+ uint64_t ofs;
+ uint64_t vma;
const char *reg_prefix = "";
op = *start++;
if (do_debug_frames_interp)
frame_display_row (fc, &need_col_headers, &max_regs);
else
- printf (" DW_CFA_advance_loc: %d to %s\n",
- opa * fc->code_factor,
- dwarf_vmatoa_1 (NULL,
- fc->pc_begin + opa * fc->code_factor,
- fc->ptr_size));
+ {
+ printf (" DW_CFA_advance_loc: %d to ",
+ opa * fc->code_factor);
+ print_hex_ns (fc->pc_begin + opa * fc->code_factor,
+ fc->ptr_size);
+ printf ("\n");
+ }
fc->pc_begin += opa * fc->code_factor;
break;
if (do_debug_frames_interp)
frame_display_row (fc, &need_col_headers, &max_regs);
else
- printf (" DW_CFA_set_loc: %s\n",
- dwarf_vmatoa_1 (NULL, vma, fc->ptr_size));
+ {
+ printf (" DW_CFA_set_loc: ");
+ print_hex_ns (vma, fc->ptr_size);
+ printf ("\n");
+ }
fc->pc_begin = vma;
break;
if (do_debug_frames_interp)
frame_display_row (fc, &need_col_headers, &max_regs);
else
- printf (" DW_CFA_advance_loc1: %ld to %s\n",
- (unsigned long) (ofs * fc->code_factor),
- dwarf_vmatoa_1 (NULL,
- fc->pc_begin + ofs * fc->code_factor,
- fc->ptr_size));
+ {
+ printf (" DW_CFA_advance_loc1: %" PRId64 " to ",
+ ofs * fc->code_factor);
+ print_hex_ns (fc->pc_begin + ofs * fc->code_factor,
+ fc->ptr_size);
+ printf ("\n");
+ }
fc->pc_begin += ofs * fc->code_factor;
break;
if (do_debug_frames_interp)
frame_display_row (fc, &need_col_headers, &max_regs);
else
- printf (" DW_CFA_advance_loc2: %ld to %s\n",
- (unsigned long) (ofs * fc->code_factor),
- dwarf_vmatoa_1 (NULL,
- fc->pc_begin + ofs * fc->code_factor,
- fc->ptr_size));
+ {
+ printf (" DW_CFA_advance_loc2: %" PRId64 " to ",
+ ofs * fc->code_factor);
+ print_hex_ns (fc->pc_begin + ofs * fc->code_factor,
+ fc->ptr_size);
+ printf ("\n");
+ }
fc->pc_begin += ofs * fc->code_factor;
break;
if (do_debug_frames_interp)
frame_display_row (fc, &need_col_headers, &max_regs);
else
- printf (" DW_CFA_advance_loc4: %ld to %s\n",
- (unsigned long) (ofs * fc->code_factor),
- dwarf_vmatoa_1 (NULL,
- fc->pc_begin + ofs * fc->code_factor,
- fc->ptr_size));
+ {
+ printf (" DW_CFA_advance_loc4: %" PRId64 " to ",
+ ofs * fc->code_factor);
+ print_hex_ns (fc->pc_begin + ofs * fc->code_factor,
+ fc->ptr_size);
+ printf ("\n");
+ }
fc->pc_begin += ofs * fc->code_factor;
break;
if (reg >= fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
- printf (" DW_CFA_offset_extended_sf: %s%s at cfa%+ld\n",
+ printf (" DW_CFA_offset_extended_sf: %s%s at cfa%+" PRId64 "\n",
reg_prefix, regname (reg, 0),
- (long)(l * fc->data_factor));
+ l * fc->data_factor);
if (*reg_prefix == '\0')
{
fc->col_type[reg] = DW_CFA_offset;
if (reg >= fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
- printf (" DW_CFA_val_offset_sf: %s%s is cfa%+ld\n",
+ printf (" DW_CFA_val_offset_sf: %s%s is cfa%+" PRId64 "\n",
reg_prefix, regname (reg, 0),
- (long)(l * fc->data_factor));
+ l * fc->data_factor);
if (*reg_prefix == '\0')
{
fc->col_type[reg] = DW_CFA_val_offset;
fc->cfa_offset = l;
fc->cfa_exp = 0;
if (! do_debug_frames_interp)
- printf (" DW_CFA_def_cfa_sf: %s ofs %ld\n",
- regname (fc->cfa_reg, 0), (long) l);
+ printf (" DW_CFA_def_cfa_sf: %s ofs %" PRId64 "\n",
+ regname (fc->cfa_reg, 0), l);
break;
case DW_CFA_def_cfa_offset_sf:
l *= fc->data_factor;
fc->cfa_offset = l;
if (! do_debug_frames_interp)
- printf (" DW_CFA_def_cfa_offset_sf: %ld\n", (long) l);
+ printf (" DW_CFA_def_cfa_offset_sf: %" PRId64 "\n", l);
break;
case DW_CFA_MIPS_advance_loc8:
if (do_debug_frames_interp)
frame_display_row (fc, &need_col_headers, &max_regs);
else
- printf (" DW_CFA_MIPS_advance_loc8: %ld to %s\n",
- (unsigned long) (ofs * fc->code_factor),
- dwarf_vmatoa_1 (NULL,
- fc->pc_begin + ofs * fc->code_factor,
- fc->ptr_size));
+ {
+ printf (" DW_CFA_MIPS_advance_loc8: %" PRId64 " to ",
+ ofs * fc->code_factor);
+ print_hex_ns (fc->pc_begin + ofs * fc->code_factor,
+ fc->ptr_size);
+ printf ("\n");
+ }
fc->pc_begin += ofs * fc->code_factor;
break;
if (reg >= fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
- printf (" DW_CFA_GNU_negative_offset_extended: %s%s at cfa%+ld\n",
+ printf (" DW_CFA_GNU_negative_offset_extended: %s%s "
+ "at cfa%+" PRId64 "\n",
reg_prefix, regname (reg, 0),
- (long)(l * fc->data_factor));
+ l * fc->data_factor);
if (*reg_prefix == '\0')
{
fc->col_type[reg] = DW_CFA_offset;
display_debug_names (struct dwarf_section *section, void *file)
{
unsigned char *hdrptr = section->start;
- dwarf_vma unit_length;
+ uint64_t unit_length;
unsigned char *unit_start;
const unsigned char *const section_end = section->start + section->size;
unsigned char *unit_end;
|| unit_length < 2 + 2 + 4 * 7)
{
too_short:
- warn (_("Debug info is corrupted, %s header at %#lx has length %s\n"),
- section->name,
- (unsigned long) (unit_start - section->start),
- dwarf_vmatoa ("x", unit_length));
+ warn (_("Debug info is corrupted, %s header at %#tx"
+ " has length %#" PRIx64 "\n"),
+ section->name, unit_start - section->start, unit_length);
return 0;
}
unit_end = hdrptr + unit_length;
/* Get and check the version number. */
SAFE_BYTE_GET_AND_INC (dwarf_version, hdrptr, 2, unit_end);
- printf (_("Version %ld\n"), (long) dwarf_version);
+ printf (_("Version %d\n"), (int) dwarf_version);
/* Prior versions did not exist, and future versions may not be
backwards compatible. */
uint64_t cu_offset;
SAFE_BYTE_GET_AND_INC (cu_offset, hdrptr, offset_size, unit_end);
- printf (_("[%3u] 0x%lx\n"), i, (unsigned long) cu_offset);
+ printf ("[%3u] 0x%" PRIx64 "\n", i, cu_offset);
}
putchar ('\n');
uint64_t tu_offset;
SAFE_BYTE_GET_AND_INC (tu_offset, hdrptr, offset_size, unit_end);
- printf (_("[%3u] 0x%lx\n"), i, (unsigned long) tu_offset);
+ printf ("[%3u] 0x%" PRIx64 "\n", i, tu_offset);
}
putchar ('\n');
SAFE_BYTE_GET_AND_INC (signature, hdrptr, 8, unit_end);
printf (_("[%3u] "), i);
- print_dwarf_vma (signature, 8);
+ print_hex (signature, 8);
putchar ('\n');
}
putchar ('\n');
+ abbrev_table_size);
if (xtra > (size_t) (unit_end - hdrptr))
{
- warn (_("Entry pool offset (0x%lx) exceeds unit size 0x%lx "
- "for unit 0x%lx in the debug_names\n"),
- (long) xtra,
- (long) (unit_end - unit_start),
- (long) (unit_start - section->start));
+ warn (_("Entry pool offset (%#" PRIx64 ") exceeds unit size %#tx "
+ "for unit %#tx in the debug_names\n"),
+ xtra, unit_end - unit_start, unit_start - section->start);
return 0;
}
const uint32_t *const hash_table_buckets = (uint32_t *) hdrptr;
}
printf (ngettext ("Used %zu of %lu bucket.\n",
"Used %zu of %lu buckets.\n",
- bucket_count),
+ (unsigned long) bucket_count),
buckets_filled, (unsigned long) bucket_count);
if (bucket_count != 0)
}
hash_prev = hash_this;
}
- printf (_("Out of %lu items there are %zu bucket clashes"
+ printf (_("Out of %" PRIu64 " items there are %zu bucket clashes"
" (longest of %zu entries).\n"),
- (unsigned long) name_count, hash_clash_count, longest_clash);
+ name_count, hash_clash_count, longest_clash);
if (name_count != buckets_filled + hash_clash_count)
- warn (_("The name_count (%lu) is not the same as the used bucket_count (%lu) + the hash clash count (%lu)"),
- (unsigned long) name_count,
- (unsigned long) buckets_filled,
- (unsigned long) hash_clash_count);
+ warn (_("The name_count (%" PRIu64 ")"
+ " is not the same as the used bucket_count"
+ " (%zu) + the hash clash count (%zu)"),
+ name_count, buckets_filled, hash_clash_count);
}
struct abbrev_lookup_entry
{
- dwarf_vma abbrev_tag;
+ uint64_t abbrev_tag;
unsigned char *abbrev_lookup_ptr;
};
struct abbrev_lookup_entry *abbrev_lookup = NULL;
unsigned char *abbrevptr = abbrev_table;
for (;;)
{
- dwarf_vma abbrev_tag;
+ uint64_t abbrev_tag;
READ_ULEB (abbrev_tag, abbrevptr, abbrev_table_end);
if (abbrev_tag == 0)
entry++)
if (entry->abbrev_tag == abbrev_tag)
{
- warn (_("Duplicate abbreviation tag %lu "
- "in unit 0x%lx in the debug_names\n"),
- (long) abbrev_tag, (long) (unit_start - section->start));
+ warn (_("Duplicate abbreviation tag %" PRIu64
+ " in unit %#tx in the debug_names section\n"),
+ abbrev_tag, unit_start - section->start);
break;
}
entry = &abbrev_lookup[abbrev_lookup_used++];
SKIP_ULEB (abbrevptr, abbrev_table_end);
for (;;)
{
- dwarf_vma xindex, form;
+ uint64_t xindex, form;
READ_ULEB (xindex, abbrevptr, abbrev_table_end);
READ_ULEB (form, abbrevptr, abbrev_table_end);
first entry for real printing etc. */
int tagno = -2;
/* Initialize it due to a false compiler warning. */
- dwarf_vma second_abbrev_tag = -1;
+ uint64_t second_abbrev_tag = -1;
for (;;)
{
- dwarf_vma abbrev_tag;
- dwarf_vma dwarf_tag;
+ uint64_t abbrev_tag;
+ uint64_t dwarf_tag;
const struct abbrev_lookup_entry *entry;
READ_ULEB (abbrev_tag, entryptr, unit_end);
if (abbrev_tag == 0)
break;
if (tagno >= 0)
- printf ("%s<%lu>",
+ printf ("%s<%" PRIu64 ">",
(tagno == 0 && second_abbrev_tag == 0 ? " " : "\n\t"),
- (unsigned long) abbrev_tag);
+ abbrev_tag);
for (entry = abbrev_lookup;
entry < abbrev_lookup + abbrev_lookup_used;
break;
if (entry >= abbrev_lookup + abbrev_lookup_used)
{
- warn (_("Undefined abbreviation tag %lu "
- "in unit 0x%lx in the debug_names\n"),
- (long) abbrev_tag,
- (long) (unit_start - section->start));
+ warn (_("Undefined abbreviation tag %" PRId64
+ " in unit %#tx in the debug_names section\n"),
+ abbrev_tag,
+ unit_start - section->start);
break;
}
abbrevptr = entry->abbrev_lookup_ptr;
printf (" %s", get_TAG_name (dwarf_tag));
for (;;)
{
- dwarf_vma xindex, form;
+ uint64_t xindex, form;
READ_ULEB (xindex, abbrevptr, abbrev_table_end);
READ_ULEB (form, abbrevptr, abbrev_table_end);
if (crc_offset + 4 < section->size)
{
- warn (_("There are %#lx extraneous bytes at the end of the section\n"),
- (long)(section->size - (crc_offset + 4)));
+ warn (_("There are %#" PRIx64
+ " extraneous bytes at the end of the section\n"),
+ section->size - (crc_offset + 4));
return 0;
}
}
}
version = byte_get_little_endian (start, 4);
- printf (_("Version %ld\n"), (long) version);
+ printf (_("Version %lu\n"), (unsigned long) version);
/* Prior versions are obsolete, and future versions may not be
backwards compatible. */
uint64_t cu_offset = byte_get_little_endian (cu_list + i * 16, 8);
uint64_t cu_length = byte_get_little_endian (cu_list + i * 16 + 8, 8);
- printf (_("[%3u] 0x%lx - 0x%lx\n"), i,
- (unsigned long) cu_offset,
- (unsigned long) (cu_offset + cu_length - 1));
+ printf ("[%3u] 0x%" PRIx64 " - 0x%" PRIx64 "\n",
+ i, cu_offset, cu_offset + cu_length - 1);
}
printf (_("\nTU table:\n"));
uint64_t type_offset = byte_get_little_endian (tu_list + i * 24 + 8, 8);
uint64_t signature = byte_get_little_endian (tu_list + i * 24 + 16, 8);
- printf (_("[%3u] 0x%lx 0x%lx "), i,
- (unsigned long) tu_offset,
- (unsigned long) type_offset);
- print_dwarf_vma (signature, 8);
+ printf ("[%3u] 0x%" PRIx64 " 0x%" PRIx64 " ",
+ i, tu_offset, type_offset);
+ print_hex (signature, 8);
printf ("\n");
}
uint64_t high = byte_get_little_endian (address_table + i * 20 + 8, 8);
uint32_t cu_index = byte_get_little_endian (address_table + i + 20 + 16, 4);
- print_dwarf_vma (low, 8);
- print_dwarf_vma (high, 8);
- printf (_("%lu\n"), (unsigned long) cu_index);
+ print_hex (low, 8);
+ print_hex (high, 8);
+ printf ("%" PRIu32 "\n", cu_index);
}
printf (_("\nSymbol table:\n"));
/* Convert to TU number if it's for a type unit. */
if (cu >= cu_list_elements)
printf ("%cT%lu", num_cus > 1 ? '\t' : ' ',
- (unsigned long) (cu - cu_list_elements));
+ (unsigned long) cu - cu_list_elements);
else
printf ("%c%lu", num_cus > 1 ? '\t' : ' ', (unsigned long) cu);
unsigned int nslots;
unsigned int i;
unsigned int j;
- dwarf_vma signature;
+ uint64_t signature;
size_t total;
/* PR 17512: file: 002-168123-0.004. */
}
if (do_display)
- printf (_(" [%3d] Signature: 0x%s Sections: "),
- i, dwarf_vmatoa ("x", signature));
+ printf (_(" [%3d] Signature: 0x%" PRIx64 " Sections: "),
+ i, signature);
for (;;)
{
if (shndx_list >= limit)
prow = poffsets + (row - 1) * ncols * 4;
if (do_display)
- printf (_(" [%3d] 0x%s"),
- i, dwarf_vmatoa ("x", signature));
+ printf (" [%3d] 0x%" PRIx64, i, signature);
for (j = 0; j < ncols; j++)
{
unsigned char *p = prow + j * 4;
prow = psizes + (row - 1) * ncols * 4;
if (do_display)
- printf (_(" [%3d] 0x%s"),
- i, dwarf_vmatoa ("x", signature));
+ printf (" [%3d] 0x%" PRIx64, i, signature);
for (j = 0; j < ncols; j++)
{
if (nmemb >= ~(size_t) 0 / size)
{
fprintf (stderr,
- _("Attempt to allocate an array with an excessive number of elements: 0x%lx\n"),
- (long) nmemb);
+ _("Attempt to allocate an array with an excessive number of elements: %#zx\n"),
+ nmemb);
xexit (1);
}
/* Check for overflow. */
if (nmemb >= ~(size_t) 0 / size)
{
- error (_("Attempt to re-allocate an array with an excessive number of elements: 0x%lx\n"),
- (long) nmemb);
+ error (_("Attempt to re-allocate an array with an excessive number of elements: %#zx\n"),
+ nmemb);
xexit (1);
}
/* Check for overflow. */
if (nmemb >= ~(size_t) 0 / size)
{
- error (_("Attempt to allocate a zero'ed array with an excessive number of elements: 0x%lx\n"),
- (long) nmemb);
+ error (_("Attempt to allocate a zero'ed array with an excessive number of elements: %#zx\n"),
+ nmemb);
xexit (1);
}