diff options
-rw-r--r-- | gdb/auxv.c | 2 | ||||
-rw-r--r-- | gdb/csky-tdep.c | 2 | ||||
-rw-r--r-- | gdb/dbxread.c | 2 | ||||
-rw-r--r-- | gdb/elfread.c | 8 | ||||
-rw-r--r-- | gdb/minsyms.c | 21 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 4 | ||||
-rw-r--r-- | gdb/ppc64-tdep.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 4 | ||||
-rw-r--r-- | gdb/symtab.h | 34 |
9 files changed, 46 insertions, 33 deletions
@@ -94,7 +94,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf, if (msym.minsym == NULL) return TARGET_XFER_E_IO; - if (MSYMBOL_SIZE (msym.minsym) != ptr_size) + if (msym.minsym->size () != ptr_size) return TARGET_XFER_E_IO; /* POINTER_ADDRESS is a location where the `_dl_auxv' variable diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index 3712409..105f5fc 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -1845,7 +1845,7 @@ csky_frame_unwind_cache (struct frame_info *this_frame) struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (prologue_start); if (msymbol.minsym != NULL) - func_size = MSYMBOL_SIZE (msymbol.minsym); + func_size = msymbol.minsym->size (); } /* If FUNC_SIZE is 0 we may have a special-case use of lr diff --git a/gdb/dbxread.c b/gdb/dbxread.c index a536a08..bcf5190 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2025,7 +2025,7 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs, if (minsym.minsym) pst->set_text_high (minsym.minsym->value_raw_address () - + MSYMBOL_SIZE (minsym.minsym)); + + minsym.minsym->size ()); last_function_name = NULL; } diff --git a/gdb/elfread.c b/gdb/elfread.c index 6df206b..b136c60 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -483,7 +483,7 @@ elf_symtab_read (minimal_symbol_reader &reader, if (type != ST_SYNTHETIC) { /* Pass symbol size field in via BFD. FIXME!!! */ - SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size); + msym->set_size (elf_sym->internal_elf_sym.st_size); } msym->filename = filesymname; @@ -522,7 +522,7 @@ elf_symtab_read (minimal_symbol_reader &reader, symaddr, mst_solib_trampoline, sym->section, objfile); if (mtramp) { - SET_MSYMBOL_SIZE (mtramp, MSYMBOL_SIZE (msym)); + mtramp->set_size (msym->size()); mtramp->created_by_gdb = 1; mtramp->filename = filesymname; if (elf_make_msymbol_special_p) @@ -640,7 +640,7 @@ elf_rel_plt_read (minimal_symbol_reader &reader, true, address, mst_slot_got_plt, msym_section, objfile); if (msym) - SET_MSYMBOL_SIZE (msym, ptr_size); + msym->set_size (ptr_size); } } @@ -836,7 +836,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) if (plt == NULL) continue; - if (MSYMBOL_SIZE (msym.minsym) != ptr_size) + if (msym.minsym->size () != ptr_size) continue; if (target_read_memory (pointer_address, buf, ptr_size) != 0) continue; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 11d357b..f1c2890 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -868,8 +868,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio if (hi > 0 && msymbol[hi].type () != want_type && msymbol[hi - 1].type () == want_type - && (MSYMBOL_SIZE (&msymbol[hi]) - == MSYMBOL_SIZE (&msymbol[hi - 1])) + && (msymbol[hi].size () == msymbol[hi - 1].size ()) && (msymbol[hi].value_raw_address () == msymbol[hi - 1].value_raw_address ()) && (msymbol[hi].obj_section (objfile) @@ -885,7 +884,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio symbol isn't an object or function (e.g. a label), or it may just mean that the size was not specified. */ - if (MSYMBOL_SIZE (&msymbol[hi]) == 0) + if (msymbol[hi].size () == 0) { if (best_zero_sized == -1) best_zero_sized = hi; @@ -899,11 +898,11 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio the nocancel variants of system calls are inside the cancellable variants, but both have sizes. */ if (hi > 0 - && MSYMBOL_SIZE (&msymbol[hi]) != 0 + && msymbol[hi].size () != 0 && pc >= (msymbol[hi].value_raw_address () - + MSYMBOL_SIZE (&msymbol[hi])) + + msymbol[hi].size ()) && pc < (msymbol[hi - 1].value_raw_address () - + MSYMBOL_SIZE (&msymbol[hi - 1]))) + + msymbol[hi - 1].size ())) { hi--; continue; @@ -920,7 +919,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio address). Also, if we ran off the end, be sure to back up. */ if (best_zero_sized != -1 - && (hi < 0 || MSYMBOL_SIZE (&msymbol[hi]) == 0)) + && (hi < 0 || msymbol[hi].size () == 0)) hi = best_zero_sized; /* If the minimal symbol has a non-zero size, and this @@ -931,9 +930,9 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio specified sizes, they do not overlap. */ if (hi >= 0 - && MSYMBOL_SIZE (&msymbol[hi]) != 0 + && msymbol[hi].size () != 0 && pc >= (msymbol[hi].value_raw_address () - + MSYMBOL_SIZE (&msymbol[hi]))) + + msymbol[hi].size ())) { if (best_zero_sized != -1) hi = best_zero_sized; @@ -1593,8 +1592,8 @@ minimal_symbol_upper_bound (struct bound_minimal_symbol minsym) lesser of the next minimal symbol in the same section, or the end of the section, as the end of the function. */ - if (MSYMBOL_SIZE (minsym.minsym) != 0) - return minsym.value_address () + MSYMBOL_SIZE (minsym.minsym); + if (minsym.minsym->size () != 0) + return minsym.value_address () + minsym.minsym->size (); /* Step over other symbols at this same address, and symbols in other sections, to find the next symbol in this section with a diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 78e7f5c..ec95d54 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -7836,11 +7836,11 @@ mips_skip_pic_trampoline_code (struct frame_info *frame, CORE_ADDR pc) return 0; /* A two-instruction header. */ - if (MSYMBOL_SIZE (msym.minsym) == 8) + if (msym.minsym->size () == 8) return pc + 8; /* A three-instruction (plus delay slot) trampoline. */ - if (MSYMBOL_SIZE (msym.minsym) == 16) + if (msym.minsym->size () == 16) { if (target_read_memory (pc, stub_code, 16) != 0) return 0; diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c index 02fcc65..32931f7 100644 --- a/gdb/ppc64-tdep.c +++ b/gdb/ppc64-tdep.c @@ -798,6 +798,6 @@ ppc64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) if ((sym->flags & BSF_SYNTHETIC) != 0 && sym->udata.p != NULL) { elf_symbol_type *elf_sym = (elf_symbol_type *) sym->udata.p; - SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size); + msym->set_size (elf_sym->internal_elf_sym.st_size); } } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 19add04..f4f64b6 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -653,8 +653,8 @@ build_address_symbolic (struct gdbarch *gdbarch, } if (msymbol.minsym != NULL - && MSYMBOL_HAS_SIZE (msymbol.minsym) - && MSYMBOL_SIZE (msymbol.minsym) == 0 + && msymbol.minsym->has_size () + && msymbol.minsym->size () == 0 && msymbol.minsym->type () != mst_text && msymbol.minsym->type () != mst_text_gnu_ifunc && msymbol.minsym->type () != mst_file_text) diff --git a/gdb/symtab.h b/gdb/symtab.h index 3bb23d6..e82572c 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -713,11 +713,33 @@ struct minimal_symbol : public general_symbol_info m_type = type; } + /* Return this minimal symbol's size. */ + + unsigned long size () const + { + return m_size; + } + + /* Set this minimal symbol's size. */ + + void set_size (unsigned long size) + { + m_size = size; + m_has_size = 1; + } + + /* Return true if this minimal symbol's size is known. */ + + bool has_size () const + { + return m_has_size; + } + /* Size of this symbol. dbx_end_psymtab in dbxread.c uses this information to calculate the end of the partial symtab based on the address of the last symbol plus the size of the last symbol. */ - unsigned long size; + unsigned long m_size; /* Which source file is this symbol in? Only relevant for mst_file_*. */ const char *filename; @@ -737,7 +759,7 @@ struct minimal_symbol : public general_symbol_info /* Nonzero iff the size of the minimal symbol has been set. Symbol size information can sometimes not be determined, because the object file format may not carry that piece of information. */ - unsigned int has_size : 1; + unsigned int m_has_size : 1; /* For data symbols only, if this is set, then the symbol might be subject to copy relocation. In this case, a minimal symbol @@ -772,14 +794,6 @@ struct minimal_symbol : public general_symbol_info #define MSYMBOL_TARGET_FLAG_1(msymbol) (msymbol)->target_flag_1 #define MSYMBOL_TARGET_FLAG_2(msymbol) (msymbol)->target_flag_2 -#define MSYMBOL_SIZE(msymbol) ((msymbol)->size + 0) -#define SET_MSYMBOL_SIZE(msymbol, sz) \ - do \ - { \ - (msymbol)->size = sz; \ - (msymbol)->has_size = 1; \ - } while (0) -#define MSYMBOL_HAS_SIZE(msymbol) ((msymbol)->has_size + 0) #include "minsyms.h" |