Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [RFA]: no "no debugging symbols found" for separate debug
Date: Mon, 12 Oct 2009 13:57:00 -0000	[thread overview]
Message-ID: <D5F0A32E-6F94-41F1-A065-D31507510BE9@adacore.com> (raw)

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;


             reply	other threads:[~2009-10-12 13:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-12 13:57 Tristan Gingold [this message]
     [not found] ` <e394668d0910121204q3535fa5bs423a968391758e2f@mail.gmail.com>
2009-10-12 19:12   ` Doug Evans
2009-10-13  7:58     ` Tristan Gingold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D5F0A32E-6F94-41F1-A065-D31507510BE9@adacore.com \
    --to=gingold@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox