This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA]: no "no debugging symbols found" for separate debug
- From: Tristan Gingold <gingold at adacore dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Mon, 12 Oct 2009 15:57:31 +0200
- Subject: [RFA]: no "no debugging symbols found" for separate debug
Hi,
when a stripped executable with a separate debug file is loaded, gdb
prints "no debugging symbols found".
I think this is confusing and this was not printed in gdb 6.8
The reason is that only the objfile is checked, not the separate debug
file.
This patch fixes that and add a test in the sepdebug.exp file.
Tristan.
2009-10-12 Tristan Gingold <gingold@adacore.com>
* objfiles.c (objfile_has_symbols): New function.
* objfiles.h (objfile_has_symbols): Add prototype.
* symfile.c (symbol_file_add_with_addrs_or_offsets): Call
objfile_has_symbols.
(reread_symbols): Ditto.
testsuite/
2009-10-12 Tristan Gingold <gingold@adacore.com>
* gdb.base/sepdebug.exp: Check debug info are found.
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.97
diff -c -r1.97 objfiles.c
*** objfiles.c 18 Sep 2009 17:33:51 -0000 1.97
--- objfiles.c 12 Oct 2009 13:52:31 -0000
***************
*** 717,722 ****
--- 717,746 ----
return objfile->symtabs != NULL;
}
+ /* Return non-zero if OBJFILE has full or partial symbols, either
directly
+ or throught its the separate debug file. */
+
+ int
+ objfile_has_symbols (struct objfile *objfile)
+ {
+ struct objfile *separate_objfile;
+
+ if (objfile_has_partial_symbols (objfile)
+ || objfile_has_full_symbols (objfile))
+ return 1;
+
+ separate_objfile = objfile->separate_debug_objfile;
+ if (separate_objfile == NULL)
+ return 0;
+
+ if (objfile_has_partial_symbols (separate_objfile)
+ || objfile_has_full_symbols (separate_objfile))
+ return 1;
+
+ return 0;
+ }
+
+
/* Many places in gdb want to test just to see if we have any partial
symbols available. This function returns zero if none are
currently
available, nonzero otherwise. */
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.64
diff -c -r1.64 objfiles.h
*** objfiles.h 11 Sep 2009 18:51:31 -0000 1.64
--- objfiles.h 12 Oct 2009 13:52:32 -0000
***************
*** 476,481 ****
--- 476,483 ----
extern int objfile_has_full_symbols (struct objfile *objfile);
+ extern int objfile_has_symbols (struct objfile *objfile);
+
extern int have_partial_symbols (void);
extern int have_full_symbols (void);
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.246
diff -c -r1.246 symfile.c
*** symfile.c 18 Sep 2009 17:33:51 -0000 1.246
--- symfile.c 12 Oct 2009 13:52:32 -0000
***************
*** 1040,1047 ****
}
if ((from_tty || info_verbose)
! && !objfile_has_partial_symbols (objfile)
! && !objfile_has_full_symbols (objfile))
{
wrap_here ("");
printf_unfiltered (_("(no debugging symbols found)..."));
--- 1040,1046 ----
}
if ((from_tty || info_verbose)
! && !objfile_has_symbols (objfile))
{
wrap_here ("");
printf_unfiltered (_("(no debugging symbols found)..."));
***************
*** 2422,2429 ****
zero is OK since dbxread.c also does what it needs to do if
objfile->global_psymbols.size is 0. */
(*objfile->sf->sym_read) (objfile, 0);
! if (!objfile_has_partial_symbols (objfile)
! && !objfile_has_full_symbols (objfile))
{
wrap_here ("");
printf_unfiltered (_("(no debugging symbols found)\n"));
--- 2421,2427 ----
zero is OK since dbxread.c also does what it needs to do if
objfile->global_psymbols.size is 0. */
(*objfile->sf->sym_read) (objfile, 0);
! if (!objfile_has_symbols (objfile))
{
wrap_here ("");
printf_unfiltered (_("(no debugging symbols found)\n"));
Index: testsuite/gdb.base/sepdebug.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sepdebug.exp,v
retrieving revision 1.19
diff -c -r1.19 sepdebug.exp
*** testsuite/gdb.base/sepdebug.exp 19 Jan 2009 19:05:01 -0000 1.19
--- testsuite/gdb.base/sepdebug.exp 12 Oct 2009 13:52:34 -0000
***************
*** 61,66 ****
--- 61,69 ----
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+ if { $gdb_file_cmd_debug_info != "debug" } then {
+ fail "No debug information found."
+ }
if [target_info exists gdb_stub] {
gdb_step_for_stub;