public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Make dwarf_vma uint64_t
@ 2022-08-13 6:52 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-08-13 6:52 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31e5a3a3807e7d5b43845d0d17ddfd1a8692752c
commit 31e5a3a3807e7d5b43845d0d17ddfd1a8692752c
Author: Alan Modra <amodra@gmail.com>
Date: Fri Aug 12 17:47:51 2022 +0930
Make dwarf_vma uint64_t
This replaces dwarf_vma, dwarf_size_type and dwarf_signed_vma with
uint64_t and int64_t everywhere. The patch also gets rid of
DWARF_VMA_FMT since we can't use that with uint64_t, and all of the
configure support for deciding the flavour of HOST_WIDEST_INT.
dwarf_vmatoa also disappears, replacing most uses with one of
PRIx64, PRId64 or PRIu64. Printing of size_t and ptrdiff_t values
now use %z and %t rather than by casting to unsigned long. Also,
most warning messages that used 0x%lx or similar now use %#lx and a
few that didn't print the 0x hex prefix now also use %#. The patch
doesn't change normal readelf output, except in odd cases where values
previously might have been truncated.
Diff:
---
binutils/config.in | 6 -
binutils/configure | 254 +------
binutils/configure.ac | 3 -
binutils/dwarf.c | 1864 +++++++++++++++++++++++--------------------------
binutils/dwarf.h | 56 +-
binutils/objdump.c | 2 +-
binutils/readelf.c | 40 +-
binutils/sysdep.h | 8 -
8 files changed, 931 insertions(+), 1302 deletions(-)
diff --git a/binutils/config.in b/binutils/config.in
index 131f09b4212..c5fb919aa95 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -185,12 +185,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* The size of `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* The size of `long long', as computed by sizeof. */
-#undef SIZEOF_LONG_LONG
-
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
diff --git a/binutils/configure b/binutils/configure
index ddb3020b3c9..542c832be18 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -1980,189 +1980,6 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_func
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=0 ac_mid=0
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid; break
-else
- as_fn_arith $ac_mid + 1 && ac_lo=$as_val
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=-1 ac_mid=-1
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=$ac_mid; break
-else
- as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
- as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid
-else
- as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (($2) < 0)
- {
- long int i = longval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%lu", i);
- }
- /* Do not output a trailing newline, as this causes \r\n confusion
- on some platforms. */
- return ferror (f) || fclose (f) != 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
- ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
- fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_compute_int
-
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
@@ -10987,7 +10804,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10990 "configure"
+#line 10807 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11093,7 +10910,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11096 "configure"
+#line 10913 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13024,73 +12841,6 @@ case "${host}" in
esac
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if ${ac_cv_sizeof_long+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_long" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_long=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if ${ac_cv_sizeof_long_long+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_long_long" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long long)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_long_long=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-
# We use headers from include/ that check various HAVE_*_H macros, thus
# should ensure they are set by configure. This is true even when C99
# guarantees they are available.
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 50dac4ee8f4..ec002d3f88f 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -174,9 +174,6 @@ case "${host}" in
esac
AC_SUBST(DEMANGLER_NAME)
-AC_CHECK_SIZEOF([long])
-AC_CHECK_SIZEOF([long long])
-
# We use headers from include/ that check various HAVE_*_H macros, thus
# should ensure they are set by configure. This is true even when C99
# guarantees they are available.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index fdbe1280ac6..a20d546e210 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -76,7 +76,7 @@ typedef struct dwo_info
{
dwo_type type;
const char * value;
- dwarf_vma cu_offset;
+ uint64_t cu_offset;
struct dwo_info * next;
} dwo_info;
@@ -119,10 +119,6 @@ unsigned long dwarf_start_die;
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
@@ -140,9 +136,9 @@ static unsigned int shndx_pool_used = 0;
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;
@@ -175,7 +171,7 @@ size_of_encoded_value (int encoding)
}
}
-static dwarf_vma
+static uint64_t
get_encoded_value (unsigned char **pdata,
int encoding,
struct dwarf_section *section,
@@ -183,7 +179,7 @@ get_encoded_value (unsigned char **pdata,
{
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))
{
@@ -220,98 +216,43 @@ get_encoded_value (unsigned char **pdata,
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.
@@ -319,17 +260,17 @@ print_dwarf_view (dwarf_vma value, unsigned num_bytes, int force)
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;
@@ -343,11 +284,11 @@ read_leb128 (unsigned char *data,
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
@@ -355,14 +296,14 @@ read_leb128 (unsigned char *data,
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;
}
}
@@ -427,7 +368,7 @@ read_leb128 (unsigned char *data,
typedef struct State_Machine_Registers
{
- dwarf_vma address;
+ uint64_t address;
unsigned int view;
unsigned int file;
unsigned int line;
@@ -470,7 +411,7 @@ process_extended_line_op (unsigned char * data,
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;
@@ -496,13 +437,13 @@ process_extended_line_op (unsigned char * 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;
@@ -522,11 +463,11 @@ process_extended_line_op (unsigned char * data,
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);
}
@@ -536,7 +477,7 @@ process_extended_line_op (unsigned char * data,
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. */
@@ -589,17 +530,17 @@ process_extended_line_op (unsigned char * data,
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);
@@ -634,7 +575,7 @@ process_extended_line_op (unsigned char * data,
}
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;
@@ -644,8 +585,7 @@ fetch_indirect_string (dwarf_vma offset)
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>");
}
@@ -662,7 +602,7 @@ fetch_indirect_string (dwarf_vma offset)
}
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;
@@ -672,8 +612,7 @@ fetch_indirect_line_string (dwarf_vma offset)
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>");
}
@@ -690,18 +629,18 @@ fetch_indirect_line_string (dwarf_vma offset)
}
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)
@@ -721,10 +660,9 @@ fetch_indexed_string (dwarf_vma idx,
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>");
}
@@ -739,8 +677,7 @@ fetch_indexed_string (dwarf_vma idx,
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>");
}
@@ -756,8 +693,8 @@ fetch_indexed_string (dwarf_vma idx,
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;
@@ -769,8 +706,8 @@ fetch_indexed_addr (dwarf_vma offset, uint32_t num_bytes)
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;
}
@@ -781,10 +718,10 @@ fetch_indexed_addr (dwarf_vma offset, uint32_t num_bytes)
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;
@@ -807,7 +744,7 @@ fetch_indexed_value (dwarf_vma idx,
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. */
@@ -818,8 +755,8 @@ fetch_indexed_value (dwarf_vma idx,
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;
}
@@ -832,10 +769,10 @@ fetch_indexed_value (dwarf_vma idx,
/* 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;
@@ -867,9 +804,9 @@ static struct abbrev_list * abbrev_lists = NULL;
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. */
@@ -881,7 +818,7 @@ static unsigned long next_free_abbrev_map_entry = 0;
#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)
@@ -962,7 +899,7 @@ find_abbrev_list_by_raw_abbrev (unsigned char *raw)
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;
@@ -1002,10 +939,10 @@ add_abbrev (unsigned long number,
}
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;
@@ -1073,7 +1010,7 @@ process_abbrev_set (struct dwarf_section *section,
{
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)
@@ -1112,9 +1049,9 @@ process_abbrev_set (struct dwarf_section *section,
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)
@@ -1124,18 +1061,16 @@ find_and_process_abbrev_set (struct dwarf_section *section,
|| 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;
}
@@ -1154,18 +1089,22 @@ find_and_process_abbrev_set (struct dwarf_section *section,
}
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;
}
@@ -1175,12 +1114,13 @@ get_TAG_name (unsigned long tag)
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];
@@ -1195,8 +1135,10 @@ get_FORM_name (unsigned long form)
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];
@@ -1210,20 +1152,20 @@ get_IDX_name (unsigned long idx)
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;
}
@@ -1233,13 +1175,13 @@ decode_location_expression (unsigned char * 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;
@@ -1251,54 +1193,50 @@ decode_location_expression (unsigned char * data,
{
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");
@@ -1311,7 +1249,7 @@ decode_location_expression (unsigned char * data,
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");
@@ -1354,7 +1292,7 @@ decode_location_expression (unsigned char * data,
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");
@@ -1370,7 +1308,7 @@ decode_location_expression (unsigned char * data,
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");
@@ -1392,7 +1330,7 @@ decode_location_expression (unsigned char * data,
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:
@@ -1499,38 +1437,37 @@ decode_location_expression (unsigned char * data,
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");
@@ -1544,15 +1481,13 @@ decode_location_expression (unsigned char * data,
/* 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
@@ -1571,7 +1506,7 @@ decode_location_expression (unsigned char * data,
{
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");
@@ -1582,9 +1517,9 @@ decode_location_expression (unsigned char * data,
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. */
@@ -1609,14 +1544,14 @@ decode_location_expression (unsigned char * data,
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:
@@ -1641,17 +1576,16 @@ decode_location_expression (unsigned char * data,
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"));
@@ -1665,64 +1599,64 @@ decode_location_expression (unsigned char * data,
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
@@ -1741,7 +1675,7 @@ decode_location_expression (unsigned char * data,
{
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. */
@@ -1801,7 +1735,7 @@ decode_location_expression (unsigned char * data,
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;
@@ -1830,7 +1764,7 @@ find_cu_tu_set_v2 (dwarf_vma cu_offset, int do_types)
}
static const char *
-fetch_alt_indirect_string (dwarf_vma offset)
+fetch_alt_indirect_string (uint64_t offset)
{
separate_info * i;
@@ -1867,8 +1801,8 @@ fetch_alt_indirect_string (dwarf_vma offset)
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>");
}
@@ -1899,7 +1833,7 @@ get_AT_name (unsigned long attribute)
}
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);
@@ -1911,19 +1845,19 @@ add_dwo_info (const char * value, dwarf_vma cu_offset, dwo_type type)
}
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);
}
@@ -1945,18 +1879,18 @@ free_dwo_info (void)
/* 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;
}
@@ -1967,14 +1901,14 @@ static unsigned char *
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;
@@ -2098,7 +2032,7 @@ skip_attr_bytes (unsigned long form,
}
* value_return = uvalue;
- if (inc <= (dwarf_vma) (end - data))
+ if (inc <= (size_t) (end - data))
data += inc;
else
data = end;
@@ -2111,7 +2045,7 @@ skip_attr_bytes (unsigned long form,
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,
@@ -2138,8 +2072,9 @@ get_type_abbrev_from_form (unsigned long form,
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;
@@ -2156,8 +2091,9 @@ get_type_abbrev_from_form (unsigned long form,
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;
@@ -2219,9 +2155,9 @@ get_type_signedness (abbrev_entry *entry,
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)
@@ -2243,7 +2179,7 @@ get_type_signedness (abbrev_entry *entry,
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);
@@ -2325,18 +2261,20 @@ read_and_print_leb128 (unsigned char *data,
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;
@@ -2415,26 +2353,26 @@ display_discr_list (unsigned long form,
}
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;
@@ -2523,7 +2461,7 @@ read_and_display_attr_value (unsigned long attribute,
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;
}
@@ -2570,7 +2508,7 @@ read_and_display_attr_value (unsigned long attribute,
{
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:
@@ -2578,9 +2516,9 @@ read_and_display_attr_value (unsigned long attribute,
{
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;
@@ -2591,14 +2529,14 @@ read_and_display_attr_value (unsigned long attribute,
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:
@@ -2607,17 +2545,17 @@ read_and_display_attr_value (unsigned long attribute,
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:
@@ -2625,18 +2563,21 @@ read_and_display_attr_value (unsigned long attribute,
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:
@@ -2689,13 +2630,11 @@ read_and_display_attr_value (unsigned long attribute,
{
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;
@@ -2704,13 +2643,11 @@ read_and_display_attr_value (unsigned long attribute,
{
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;
@@ -2730,11 +2667,11 @@ read_and_display_attr_value (unsigned long attribute,
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;
@@ -2743,13 +2680,11 @@ read_and_display_attr_value (unsigned long attribute,
{
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;
@@ -2759,8 +2694,8 @@ read_and_display_attr_value (unsigned long attribute,
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:
@@ -2773,7 +2708,7 @@ read_and_display_attr_value (unsigned long attribute,
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;
@@ -2782,7 +2717,7 @@ read_and_display_attr_value (unsigned long attribute,
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)
@@ -2810,7 +2745,7 @@ read_and_display_attr_value (unsigned long attribute,
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
@@ -2822,7 +2757,7 @@ read_and_display_attr_value (unsigned long attribute,
/* 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;
}
}
@@ -2840,16 +2775,15 @@ read_and_display_attr_value (unsigned long attribute,
}
/* 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:
@@ -2867,26 +2801,26 @@ read_and_display_attr_value (unsigned long attribute,
{
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;
@@ -2922,10 +2856,10 @@ read_and_display_attr_value (unsigned long attribute,
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 *)
@@ -2996,7 +2930,7 @@ read_and_display_attr_value (unsigned long attribute,
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;
@@ -3143,8 +3077,8 @@ read_and_display_attr_value (unsigned long attribute,
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;
@@ -3200,10 +3134,9 @@ read_and_display_attr_value (unsigned long attribute,
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;
@@ -3460,9 +3393,9 @@ read_and_display_attr_value (unsigned long attribute,
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
{
@@ -3481,21 +3414,21 @@ read_and_display_attr_value (unsigned long attribute,
}
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));
@@ -3604,7 +3537,7 @@ process_debug_info (struct dwarf_section * section,
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
@@ -3615,8 +3548,8 @@ process_debug_info (struct dwarf_section * section,
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;
}
@@ -3625,10 +3558,9 @@ process_debug_info (struct dwarf_section * section,
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;
@@ -3700,13 +3632,13 @@ process_debug_info (struct dwarf_section * section,
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;
@@ -3782,12 +3714,12 @@ process_debug_info (struct dwarf_section * section,
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;
@@ -3896,10 +3828,10 @@ process_debug_info (struct dwarf_section * section,
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)
@@ -3910,36 +3842,30 @@ process_debug_info (struct dwarf_section * section,
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]);
}
}
@@ -3948,9 +3874,9 @@ process_debug_info (struct dwarf_section * section,
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;
}
@@ -3960,9 +3886,9 @@ process_debug_info (struct dwarf_section * section,
&& 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;
}
@@ -4062,7 +3988,7 @@ process_debug_info (struct dwarf_section * section,
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;
}
@@ -4102,7 +4028,7 @@ process_debug_info (struct dwarf_section * section,
{
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,
@@ -4127,7 +4053,7 @@ process_debug_info (struct dwarf_section * section,
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);
@@ -4248,8 +4174,10 @@ read_debug_line_header (struct dwarf_section * section,
}
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;
}
}
@@ -4317,7 +4245,7 @@ display_formatted_table (unsigned char *data,
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");
@@ -4346,8 +4274,8 @@ display_formatted_table (unsigned char *data,
}
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;
}
@@ -4358,9 +4286,8 @@ display_formatted_table (unsigned char *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. */
@@ -4369,7 +4296,7 @@ display_formatted_table (unsigned char *data,
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))
@@ -4391,8 +4318,8 @@ display_formatted_table (unsigned char *data,
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);
}
@@ -4411,7 +4338,7 @@ display_formatted_table (unsigned char *data,
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);
@@ -4445,7 +4372,7 @@ display_debug_sup (struct dwarf_section * section,
size_t sup_filename_len;
unsigned int num_read;
int status;
- dwarf_vma checksum_len;
+ uint64_t checksum_len;
introduce (section, true);
@@ -4483,21 +4410,22 @@ display_debug_sup (struct dwarf_section * section,
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: "));
@@ -4561,8 +4489,8 @@ display_debug_lines_raw (struct dwarf_section * section,
& 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)
{
@@ -4625,8 +4553,8 @@ display_debug_lines_raw (struct dwarf_section * section,
{
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)
{
@@ -4651,14 +4579,14 @@ display_debug_lines_raw (struct dwarf_section * section,
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;
@@ -4667,11 +4595,11 @@ display_debug_lines_raw (struct dwarf_section * section,
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)
@@ -4701,10 +4629,10 @@ display_debug_lines_raw (struct dwarf_section * section,
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++;
@@ -4719,9 +4647,9 @@ display_debug_lines_raw (struct dwarf_section * section,
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)") : "");
}
@@ -4739,17 +4667,17 @@ display_debug_lines_raw (struct dwarf_section * section,
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
@@ -4782,9 +4710,9 @@ display_debug_lines_raw (struct dwarf_section * section,
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)") : "");
}
@@ -4801,9 +4729,9 @@ display_debug_lines_raw (struct dwarf_section * section,
% 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)") : "");
@@ -4813,29 +4741,27 @@ display_debug_lines_raw (struct dwarf_section * section,
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;
@@ -4852,9 +4778,9 @@ display_debug_lines_raw (struct dwarf_section * section,
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)") : "");
}
@@ -4871,9 +4797,9 @@ display_debug_lines_raw (struct dwarf_section * section,
% 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)") : "");
@@ -4884,9 +4810,9 @@ display_debug_lines_raw (struct dwarf_section * section,
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;
@@ -4900,7 +4826,7 @@ display_debug_lines_raw (struct dwarf_section * section,
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:
@@ -4910,8 +4836,7 @@ display_debug_lines_raw (struct dwarf_section * section,
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;
@@ -4955,7 +4880,7 @@ display_debug_lines_decoded (struct dwarf_section * section,
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.
@@ -5006,7 +4931,7 @@ display_debug_lines_decoded (struct dwarf_section * section,
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);
@@ -5042,8 +4967,8 @@ display_debug_lines_decoded (struct dwarf_section * section,
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);
@@ -5116,8 +5041,8 @@ display_debug_lines_decoded (struct dwarf_section * section,
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);
@@ -5282,8 +5207,8 @@ display_debug_lines_decoded (struct dwarf_section * section,
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
@@ -5473,8 +5398,8 @@ display_debug_lines_decoded (struct dwarf_section * section,
/* 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
@@ -5548,11 +5473,10 @@ display_debug_lines_decoded (struct dwarf_section * section,
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;
@@ -5607,23 +5531,23 @@ display_debug_lines_decoded (struct dwarf_section * section,
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);
@@ -5634,23 +5558,23 @@ display_debug_lines_decoded (struct dwarf_section * section,
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);
@@ -5726,7 +5650,7 @@ display_debug_lines (struct dwarf_section *section, void *file)
}
static debug_info *
-find_debug_info_for_offset (dwarf_vma offset)
+find_debug_info_for_offset (uint64_t offset)
{
unsigned int i;
@@ -5791,10 +5715,9 @@ display_debug_pubnames_worker (struct dwarf_section *section,
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;
}
@@ -5807,19 +5730,20 @@ display_debug_pubnames_worker (struct dwarf_section *section,
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)
{
@@ -5842,7 +5766,7 @@ display_debug_pubnames_worker (struct dwarf_section *section,
while (1)
{
size_t maxprint;
- dwarf_vma offset;
+ uint64_t offset;
SAFE_BYTE_GET_AND_INC (offset, data, offset_size, start);
@@ -5870,13 +5794,13 @@ display_debug_pubnames_worker (struct dwarf_section *section,
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)
@@ -5982,15 +5906,15 @@ display_debug_macinfo (struct dwarf_section *section,
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;
@@ -6103,7 +6027,7 @@ display_debug_macro (struct dwarf_section *section,
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);
@@ -6116,20 +6040,19 @@ display_debug_macro (struct dwarf_section *section,
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);
@@ -6273,28 +6196,30 @@ display_debug_macro (struct dwarf_section *section,
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:
@@ -6308,7 +6233,7 @@ display_debug_macro (struct dwarf_section *section,
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;
@@ -6328,7 +6253,7 @@ display_debug_macro (struct dwarf_section *section,
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)
@@ -6375,7 +6300,7 @@ display_debug_abbrev (struct dwarf_section *section,
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);
@@ -6383,7 +6308,7 @@ display_debug_abbrev (struct dwarf_section *section,
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)
{
@@ -6400,7 +6325,7 @@ display_debug_abbrev (struct dwarf_section *section,
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');
}
}
@@ -6418,9 +6343,9 @@ display_debug_abbrev (struct dwarf_section *section,
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);
}
@@ -6444,18 +6369,18 @@ display_view_pair_list (struct dwarf_section *section,
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"));
}
@@ -6469,19 +6394,19 @@ static void
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;
@@ -6506,18 +6431,18 @@ display_loc_list (struct dwarf_section *section,
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);
@@ -6543,8 +6468,8 @@ display_loc_list (struct dwarf_section *section,
&& !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;
}
@@ -6554,19 +6479,18 @@ display_loc_list (struct dwarf_section *section,
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;
}
@@ -6574,13 +6498,13 @@ display_loc_list (struct dwarf_section *section,
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 st[...]
[diff truncated at 100000 bytes]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-13 6:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 6:52 [binutils-gdb] Make dwarf_vma uint64_t Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).