aboutsummaryrefslogtreecommitdiff
path: root/COPYING3
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2020-10-17 00:10:31 +0200
committerTom de Vries <tdevries@suse.de>2020-10-17 00:10:31 +0200
commit520596f2eb7430dca76d887dc6c39698654af728 (patch)
treee3e7b3f484c9331a722f76bf43ba14b70f47236a /COPYING3
parentd1c8a76d05e3224449cb3849f42e26db6b0eabfe (diff)
downloadgdb-520596f2eb7430dca76d887dc6c39698654af728.zip
gdb-520596f2eb7430dca76d887dc6c39698654af728.tar.gz
gdb-520596f2eb7430dca76d887dc6c39698654af728.tar.bz2
[gdb/symtab] Handle setting line bp without debug line info
When setting a breakpoint on a line in an executable without debug line info, we run into an abort. The problem occurs when calling set_default_source_symtab_and_line, which calls select_source_symtab (0), which is where we try to find the line number for main: ... /* Make the default place to list be the function `main' if one exists. */ block_symbol bsym = lookup_symbol (main_name (), 0, VAR_DOMAIN, 0); if (bsym.symbol != nullptr && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK) { symtab_and_line sal = find_function_start_sal (bsym.symbol, true); loc->set (sal.symtab, std::max (sal.line - (lines_to_list - 1), 1)); return; } ... However, due to the missing debug line info, find_function_start_sal returns a sal with sal.symtab == 0: ... (gdb) p /x sal $2 = {pspace = 0x1a4a7f0, symtab = 0x0, symbol = 0x1d9e480, section = 0x1d5b398, msymbol = 0x0, line = 0x0, pc = 0x4004ab, end = 0x0, explicit_pc = 0x0, explicit_line = 0x0, is_stmt = 0x0, prob = 0x0, objfile = 0x0} ... which eventually causes an segfault in create_sals_line_offset because self->default_symtab->filename is accessed while self->default_symtab == NULL. Fix this by handling sal.symtab == NULL in select_source_symtab. Tested on x86_64-linux. gdb/ChangeLog: 2020-10-17 Tom de Vries <tdevries@suse.de> PR symtab/26317 * source.c (select_source_symtab): Handling sal.symtab == NULL for symbol main. gdb/testsuite/ChangeLog: 2020-10-17 Tom de Vries <tdevries@suse.de> PR symtab/26317 * gdb.dwarf2/dw2-main-no-line-number.exp: New file.
Diffstat (limited to 'COPYING3')
0 files changed, 0 insertions, 0 deletions