diff options
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 66 |
1 files changed, 29 insertions, 37 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index d4089c8..b0cea7a 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2904,14 +2904,7 @@ find_symbol_at_address (CORE_ADDR address) struct symtab_and_line find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) { - struct compunit_symtab *cust; - const linetable *l; - int len; - const linetable_entry *item; - const struct blockvector *bv; - /* Info on best line seen so far, and where it starts, and its file. */ - const linetable_entry *best = NULL; CORE_ADDR best_end = 0; struct symtab *best_symtab = 0; @@ -3034,7 +3027,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) symtab_and_line val; val.pspace = current_program_space; - cust = find_pc_sect_compunit_symtab (pc, section); + compunit_symtab *cust = find_pc_sect_compunit_symtab (pc, section); if (cust == NULL) { /* If no symbol information, return previous pc. */ @@ -3044,7 +3037,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) return val; } - bv = cust->blockvector (); + const blockvector *bv = cust->blockvector (); struct objfile *objfile = cust->objfile (); /* Look at all the symtabs that share this blockvector. @@ -3054,10 +3047,11 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) for (symtab *iter_s : cust->filetabs ()) { /* Find the best line in this symtab. */ - l = iter_s->linetable (); + const linetable *l = iter_s->linetable (); if (!l) continue; - len = l->nitems; + + int len = l->nitems; if (len <= 0) { /* I think len can be zero if the symtab lacks line numbers @@ -3068,7 +3062,8 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) } prev = NULL; - item = l->item; /* Get first line info. */ + /* Get first line info. */ + const linetable_entry *item = l->item; /* Is this file's first line closer than the first lines of other files? If so, record this file, and its first line, as best alternate. */ @@ -3688,16 +3683,6 @@ skip_prologue_using_linetable (CORE_ADDR func_addr) void skip_prologue_sal (struct symtab_and_line *sal) { - struct symbol *sym; - struct symtab_and_line start_sal; - CORE_ADDR pc, saved_pc; - struct obj_section *section; - const char *name; - struct objfile *objfile; - struct gdbarch *gdbarch; - const struct block *b, *function_block; - int force_skip, skip; - /* Do not change the SAL if PC was specified explicitly. */ if (sal->explicit_pc) return; @@ -3715,7 +3700,12 @@ skip_prologue_sal (struct symtab_and_line *sal) switch_to_program_space_and_thread (sal->pspace); - sym = find_pc_sect_function (sal->pc, sal->section); + symbol *sym = find_pc_sect_function (sal->pc, sal->section); + objfile *objfile; + CORE_ADDR pc; + obj_section *section; + const char *name; + if (sym != NULL) { objfile = sym->objfile (); @@ -3737,15 +3727,15 @@ skip_prologue_sal (struct symtab_and_line *sal) name = msymbol.minsym->linkage_name (); } - gdbarch = objfile->arch (); + gdbarch *gdbarch = objfile->arch (); /* Process the prologue in two passes. In the first pass try to skip the prologue (SKIP is true) and verify there is a real need for it (indicated by FORCE_SKIP). If no such reason was found run a second pass where the prologue is not skipped (SKIP is false). */ - skip = 1; - force_skip = 1; + int skip = 1; + int force_skip = 1; /* Be conservative - allow direct PC (without skipping prologue) only if we have proven the CU (Compilation Unit) supports it. sal->SYMTAB does not @@ -3754,7 +3744,9 @@ skip_prologue_sal (struct symtab_and_line *sal) && sym->symtab ()->compunit ()->locations_valid ()) force_skip = 0; - saved_pc = pc; + symtab_and_line start_sal; + CORE_ADDR saved_pc = pc; + do { pc = saved_pc; @@ -3849,16 +3841,16 @@ skip_prologue_sal (struct symtab_and_line *sal) /* Check if we are now inside an inlined function. If we can, use the call site of the function instead. */ - b = block_for_pc_sect (sal->pc, sal->section); - function_block = NULL; - while (b != NULL) - { - if (b->function () != NULL && b->inlined_p ()) - function_block = b; - else if (b->function () != NULL) - break; - b = b->superblock (); - } + const block *function_block = nullptr; + + for (const block *b = block_for_pc_sect (sal->pc, sal->section); + b != nullptr; + b = b->superblock ()) + if (b->function () != NULL && b->inlined_p ()) + function_block = b; + else if (b->function () != NULL) + break; + if (function_block != NULL && function_block->function ()->line () != 0) { |