[6/7] Use bound_minimal_symbol more in lookup_minimal_symbol_by_pc_section
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
fail
|
Testing failed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
fail
|
Testing failed
|
Commit Message
lookup_minimal_symbol_by_pc_section tracks the best symbol and
objfile. This patch changes it to use a bound_minimal_symbol rather
than two separate variables. This simplifies the code a little.
---
gdb/minsyms.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
@@ -968,9 +968,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
lookup_msym_prefer prefer,
bound_minimal_symbol *previous)
{
- struct minimal_symbol *best_symbol = NULL;
- struct objfile *best_objfile = NULL;
- struct bound_minimal_symbol result;
+ struct bound_minimal_symbol best = {};
if (previous != nullptr)
{
@@ -1036,18 +1034,13 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
/* MINSYM now is the best one in this objfile's minimal symbol
table. See if it is the best one overall. */
if (minsym != nullptr
- && ((best_symbol == NULL) ||
- (best_symbol->unrelocated_address ()
- < minsym->unrelocated_address ())))
- {
- best_symbol = minsym;
- best_objfile = objfile;
- }
+ && (best.minsym == nullptr
+ || (best.minsym->unrelocated_address ()
+ < minsym->unrelocated_address ())))
+ best = { minsym, objfile };
}
- result.minsym = best_symbol;
- result.objfile = best_objfile;
- return result;
+ return best;
}
/* See minsyms.h. */