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.
This commit is contained in:
Alan Modra
2022-08-12 17:47:51 +09:30
parent 625d49fce7
commit 31e5a3a380
8 changed files with 935 additions and 1306 deletions

View File

@ -20,18 +20,14 @@
#include "dwarf2.h" /* for enum dwarf_unit_type */
typedef unsigned HOST_WIDEST_INT dwarf_vma;
typedef HOST_WIDEST_INT dwarf_signed_vma;
typedef unsigned HOST_WIDEST_INT dwarf_size_type;
/* Structure found in the .debug_line section. */
typedef struct
{
dwarf_vma li_length;
uint64_t li_length;
unsigned short li_version;
unsigned char li_address_size;
unsigned char li_segment_size;
dwarf_vma li_prologue_length;
uint64_t li_prologue_length;
unsigned char li_min_insn_length;
unsigned char li_max_ops_per_insn;
unsigned char li_default_is_stmt;
@ -45,19 +41,19 @@ DWARF2_Internal_LineInfo;
/* Structure found in .debug_pubnames section. */
typedef struct
{
dwarf_vma pn_length;
uint64_t pn_length;
unsigned short pn_version;
dwarf_vma pn_offset;
dwarf_vma pn_size;
uint64_t pn_offset;
uint64_t pn_size;
}
DWARF2_Internal_PubNames;
/* Structure found in .debug_info section. */
typedef struct
{
dwarf_vma cu_length;
uint64_t cu_length;
unsigned short cu_version;
dwarf_vma cu_abbrev_offset;
uint64_t cu_abbrev_offset;
unsigned char cu_pointer_size;
enum dwarf_unit_type cu_unit_type;
}
@ -66,9 +62,9 @@ DWARF2_Internal_CompUnit;
/* Structure found in .debug_aranges section. */
typedef struct
{
dwarf_vma ar_length;
uint64_t ar_length;
unsigned short ar_version;
dwarf_vma ar_info_offset;
uint64_t ar_info_offset;
unsigned char ar_pointer_size;
unsigned char ar_segment_size;
}
@ -143,8 +139,8 @@ struct dwarf_section
file containing the section. */
const char * filename;
unsigned char * start;
dwarf_vma address;
dwarf_size_type size;
uint64_t address;
uint64_t size;
enum dwarf_section_display_enum abbrev_sec;
/* Used by clients to help them implement the reloc_at callback. */
void * reloc_info;
@ -170,32 +166,32 @@ typedef struct
unsigned int pointer_size;
unsigned int offset_size;
int dwarf_version;
dwarf_vma cu_offset;
dwarf_vma base_address;
uint64_t cu_offset;
uint64_t base_address;
/* This field is filled in when reading the attribute DW_AT_GNU_addr_base and
is used with the form DW_FORM_GNU_addr_index. */
dwarf_vma addr_base;
uint64_t addr_base;
/* This field is filled in when reading the attribute DW_AT_GNU_ranges_base and
is used when calculating ranges. */
dwarf_vma ranges_base;
uint64_t ranges_base;
/* This is an array of offsets to the location list table. */
dwarf_vma * loc_offsets;
uint64_t * loc_offsets;
/* This is an array of offsets to the location view table. */
dwarf_vma * loc_views;
uint64_t * loc_views;
int * have_frame_base;
/* Information for associating location lists with CUs. */
unsigned int num_loc_offsets;
unsigned int max_loc_offsets;
unsigned int num_loc_views;
dwarf_vma loclists_base;
uint64_t loclists_base;
/* List of .debug_ranges offsets seen in this .debug_info. */
dwarf_vma * range_lists;
uint64_t * range_lists;
unsigned int num_range_lists;
unsigned int max_range_lists;
dwarf_vma rnglists_base;
dwarf_vma str_offsets_base;
uint64_t rnglists_base;
uint64_t str_offsets_base;
}
debug_info;
@ -268,10 +264,10 @@ extern void * xcrealloc (void *, size_t, size_t);
/* A callback into the client. Returns TRUE if there is a
relocation against the given debug section at the given
offset. */
extern bool reloc_at (struct dwarf_section *, dwarf_vma);
extern bool reloc_at (struct dwarf_section *, uint64_t);
extern dwarf_vma read_leb128 (unsigned char *, const unsigned char *const,
bool, unsigned int *, int *);
extern uint64_t read_leb128 (unsigned char *, const unsigned char *const,
bool, unsigned int *, int *);
#if HAVE_LIBDEBUGINFOD
extern unsigned char * get_build_id (void *);
@ -307,7 +303,7 @@ report_leb_status (int status)
#define READ_ULEB(var, start, end) \
do \
{ \
dwarf_vma _val; \
uint64_t _val; \
unsigned int _len; \
int _status; \
\
@ -323,7 +319,7 @@ report_leb_status (int status)
#define READ_SLEB(var, start, end) \
do \
{ \
dwarf_signed_vma _val; \
int64_t _val; \
unsigned int _len; \
int _status; \
\