This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
symtab/1677: [regression] selftest.exp, crash in lookup_symtab
- From: mec dot gnu at mindspring dot com
- To: gdb-gnats at sources dot redhat dot com
- Cc: bob at brasko dot net
- Date: 16 Jun 2004 18:49:43 -0000
- Subject: symtab/1677: [regression] selftest.exp, crash in lookup_symtab
- Reply-to: mec dot gnu at mindspring dot com
>Number: 1677
>Category: symtab
>Synopsis: [regression] selftest.exp, crash in lookup_symtab
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jun 16 18:58:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: mec.gnu@mindspring.com
>Release: gdb HEAD 2004-06-13 05:30:11 UTC
>Organization:
>Environment:
native i686-pc-linux-gnu
red hat 8.0
gdb HEAD 2004-06-13 05:30:11 UTC
gdb compiled with gcc 3.3.2
dwarf-2
>Description:
gdb crashes in selftest.exp.
gdb.log excerpt:
(gdb) PASS: gdb.base/selftest.exp: print a string
step^M
xmalloc (size=0) at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/utils.c:1128^M
1128 return xmmalloc (NULL, size);^M
(gdb) PASS: gdb.base/selftest.exp: step into xmalloc call
continue^M
Continuing.^M
FAIL: gdb.base/selftest.exp: (timeout) Set xgdb prompt
Stack trace:
(gdb) bt 6
#0 0x4207931a in strcmp () from /lib/i686/libc.so.6
#1 0x080eb0ca in lookup_symtab (
name=0xbfffe99c "/berman/fsf/_today_/source/gdb/HEAD/src/gdb/main.c")
at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/symtab.c:185
#2 0x080f7ea3 in symtab_from_filename (argptr=0xbfffeaac,
p=0x32 <Address 0x32 out of bounds>, is_quote_enclosed=0,
not_found_ptr=0x0)
at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/linespec.c:1523
#3 0x080f719b in decode_line_1 (argptr=0xbfffeaac, funfirstline=1,
default_symtab=0x871a6d0, default_line=1128, canonical=0x0,
not_found_ptr=0x0)
at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/linespec.c:744
#4 0x080cebaa in breakpoint_re_set_one (bint=0x84dbd50)
at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/breakpoint.c:7149
#5 0x0807f001 in do_catch_errors (uiout=0x82ced48, data=0x2f)
at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/top.c:524
(More stack frames follow...)
Code fragment:
(gdb) frame 1
(gdb) list
182 if (full_path != NULL)
183 {
184 const char *fp = symtab_to_fullname (s);
185 if (FILENAME_CMP (full_path, fp) == 0)
186 {
187 return s;
188 }
189 }
Data dump:
(gdb) print *s
$2 = {next = 0x8517dfc, blockvector = 0x851af74, linetable = 0x0,
block_line_section = 11, primary = 1, macro_table = 0x0,
filename = 0x851afc4 "version.c",
dirname = 0x851afd8 "/berman/fsf/_today_/berman/build/target/native/gdb/HEAD
line_charpos = 0x0, language = language_c,
debugformat = 0x851b014 "DWARF 2", version = 0x0, fullname = 0x0,
objfile = 0x82ef630}
Check it out. s->fullname is NULL, so lookup_symtab barfs out when it calls FILENAME_CMP.
I suspect this patch, although it might be something else:
2004-06-10 Bob Rossi <bob@brasko.net>
* dbxread.c (read_dbx_symtab): Set pst->dirname when known.
* dwarf2read.c (partial_die_info) : Add dirname field.
(dwarf2_build_psymtabs_hard) : Set pst->dirname when known.
(read_partial_die) : Save away DW_AT_comp_dir.
* defs.h (symtab_to_filename) : Removed.
* source.c (find_and_open_source) : Added.
(open_source_file): Just calls find_and_open_source.
(symtab_to_filename) : Removed.
(symtab_to_fullname, psymtab_to_fullname ) : Added.
* source.h (psymtab_to_fullname,symtab_to_fullname): Added.
* symtab.c (lookup_symtab): Call symtab_to_fullname instead of
symtab_to_filename.
* symtab.h (partial_symtab): Add dirname field.
* mi/mi-cmd-file.c (FILENAME,FULLNAME): Added.
(mi_cmd_file_list_exec_source_file): Call new function symtab_to_fullnam
to find fullname.
(mi_cmd_file_list_exec_source_files): Added.
* mi/mi-cmds.c (mi_cmd_mi_cmds) : Add -file-list-exec-source-files.
* mi/mi-cmds.h (mi_cmd_file_list_exec_source_files): Added.
This regressed some time between gdb HEAD 2004-06-06 19:02:08 UTC and gdb HEAD 2004-06-13 05:30:11 UTC. To be formal, it worked with gdb 6.1.
>How-To-Repeat:
Run selftest.exp.
I could do some work and trim this down to a much smaller test case if requested.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: