diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-10 15:07:04 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-11 09:50:58 +0000 |
commit | 1db66e348ac6fb5456dd76ddd700434e5cb5ba31 (patch) | |
tree | dafcb5402eda5fe2fc192ba62926b8af192d0379 /gdb | |
parent | 31c711a2b302cf27f2cb4d5dd2c495407b384b94 (diff) | |
download | gdb-1db66e348ac6fb5456dd76ddd700434e5cb5ba31.zip gdb-1db66e348ac6fb5456dd76ddd700434e5cb5ba31.tar.gz gdb-1db66e348ac6fb5456dd76ddd700434e5cb5ba31.tar.bz2 |
gdb: add obj_section function to bound_minimal_symbol
Add a new obj_section function to bound_minimal_symbol, this just
calls obj_section on the contained minimal_symbol passing in the
contained objfile.
This allows some minor code simplification in a few places.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* breakpoint.c (resolve_sal_pc): Make use of
bound_minimal_symbol::obj_section.
* maint.c (maintenance_translate_address): Likewise.
* minsyms.c (minimal_symbol_upper_bound): Likewise.
* minsyms.h (struct bound_minimal_symbol) <obj_section>: New
member function.
* printcmd.c (info_address_command): Make use of
bound_minimal_symbol::obj_section.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/breakpoint.c | 2 | ||||
-rw-r--r-- | gdb/maint.c | 2 | ||||
-rw-r--r-- | gdb/minsyms.c | 2 | ||||
-rw-r--r-- | gdb/minsyms.h | 7 | ||||
-rw-r--r-- | gdb/printcmd.c | 2 |
6 files changed, 22 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 408d388..69e14b3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2021-02-11 Andrew Burgess <andrew.burgess@embecosm.com> + + * breakpoint.c (resolve_sal_pc): Make use of + bound_minimal_symbol::obj_section. + * maint.c (maintenance_translate_address): Likewise. + * minsyms.c (minimal_symbol_upper_bound): Likewise. + * minsyms.h (struct bound_minimal_symbol) <obj_section>: New + member function. + * printcmd.c (info_address_command): Make use of + bound_minimal_symbol::obj_section. + 2021-02-11 Alan Modra <amodra@gmail.com> * arm-symbian-tdep.c: Delete. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 5f1914e..e9aba79 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9691,7 +9691,7 @@ resolve_sal_pc (struct symtab_and_line *sal) bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (sal->pc); if (msym.minsym) - sal->section = msym.minsym->obj_section (msym.objfile); + sal->section = msym.obj_section (); } } } diff --git a/gdb/maint.c b/gdb/maint.c index 7495cab..f6e42f6 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -509,7 +509,7 @@ maintenance_translate_address (const char *arg, int from_tty) const char *symbol_offset = pulongest (address - BMSYMBOL_VALUE_ADDRESS (sym)); - sect = sym.minsym->obj_section (sym.objfile); + sect = sym.obj_section (); if (sect != NULL) { const char *section_name; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 8b8e11a..3cf849f 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1561,7 +1561,7 @@ minimal_symbol_upper_bound (struct bound_minimal_symbol minsym) break; } - obj_section = minsym.minsym->obj_section (minsym.objfile); + obj_section = minsym.obj_section (); if (iter != past_the_end && (MSYMBOL_VALUE_ADDRESS (minsym.objfile, iter) < obj_section_endaddr (obj_section))) diff --git a/gdb/minsyms.h b/gdb/minsyms.h index 75de98c..7f21871 100644 --- a/gdb/minsyms.h +++ b/gdb/minsyms.h @@ -37,6 +37,13 @@ struct bound_minimal_symbol symbol is defined. */ struct objfile *objfile; + + /* Return the obj_section from OBJFILE for MINSYM. */ + + struct obj_section *obj_section () const + { + return minsym->obj_section (objfile); + } }; /* This header declares most of the API for dealing with minimal diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 1e328a7..58e39c7 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1678,7 +1678,7 @@ info_address_command (const char *exp, int from_tty) printf_filtered ("unresolved"); else { - section = msym.minsym->obj_section (msym.objfile); + section = msym.obj_section (); if (section && (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) |