diff options
author | Eli Zaretskii <eliz@gnu.org> | 2018-12-28 09:02:04 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2018-12-28 09:02:04 +0200 |
commit | 156f23669270533e1499e15e49842468800c2681 (patch) | |
tree | c775c014b25c7797af20bd73d73a2dac7d567d7c /gdb/coffread.c | |
parent | 0e41bebb938dbe9eae7063f5321429194bfc5ab7 (diff) | |
download | gdb-156f23669270533e1499e15e49842468800c2681.zip gdb-156f23669270533e1499e15e49842468800c2681.tar.gz gdb-156f23669270533e1499e15e49842468800c2681.tar.bz2 |
Avoid internal errors when stepping outside 'main' on MinGW
When one steps with "next" past the 'main's 'return' statement
in MinGW programs built by mingw.org's tools, PC lands in a
function whose symbol is not in any symtab. GDB then looks
up the nearest symbol, and should find none, because all those
with addresses below PC are not real functions. Having
unresolved symbols, whose address is zero, in minsyms tricked
GDB into using these bogus symbols, which then caused
assertion violation and internal_error. See the discussion at
https://sourceware.org/ml/gdb-patches/2018-12/msg00176.html
for more details.
gdb/ChangeLog
2018-12-28 Eli Zaretskii <eliz@gnu.org>
* coffread.c (coff_symtab_read): Don't record in minsyms symbols
that are unresolved. This avoids triggering an internal error
when stepping outside of 'main' in MinGW programs.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r-- | gdb/coffread.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c index a473b78..cab5707 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -877,8 +877,10 @@ coff_symtab_read (minimal_symbol_reader &reader, int section = cs_to_section (cs, objfile); tmpaddr = cs->c_value; - record_minimal_symbol (reader, cs, tmpaddr, mst_text, - section, objfile); + /* Don't record unresolved symbols. */ + if (!(cs->c_secnum <= 0 && cs->c_value == 0)) + record_minimal_symbol (reader, cs, tmpaddr, mst_text, + section, objfile); fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr; fcn_start_addr = tmpaddr; |