Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tromey@redhat.com>
Subject: Re: [patch] Fix dangling displays in separate debug
Date: Fri, 09 Apr 2010 20:01:00 -0000	[thread overview]
Message-ID: <20100409200046.GA22709@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <201004091747.50536.pedro@codesourcery.com>

On Fri, 09 Apr 2010 18:47:50 +0200, Pedro Alves wrote:
> On Friday 09 April 2010 16:52:49, Jan Kratochvil wrote:
> > -         if (SYMBOL_SYMTAB (symbol)->objfile == solib->objfile)
> > +         symbol_objfile = SYMBOL_SYMTAB (symbol)->objfile;
> > +         if (symbol_objfile == solib->objfile
> > +             || symbol_objfile->separate_debug_objfile_backlink
> > +                == solib->objfile)
> >             return 1;
> 
> Can't both `symbol_objfile->separate_debug_objfile_backlink' (because
> symbol_objfile is the main objfile already)

Yes, it can be NULL.

> and `solib->objfile'
> (because GDB didn't find any symbols for the shared library) be NULL,

I was convinced due to some invalid reasons solib->objfile cannot be NULL.

> and hence this returns false positives?

Yes, there was a regression, thanks for catching it.


No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.


Thanks,
Jan


gdb/
2010-04-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
	    Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <pedro@codesourcery.com>

	* printcmd.c (display_uses_solib_p): Check also
	SEPARATE_DEBUG_OBJFILE_BACKLINK.  New variable symbol_objfile.
	* solist.h (struct so_list) <objfile>: New comment.
	* symtab.h (struct general_symbol_info) <obj_section>: Extend the
	comment.

gdb/testsuite/
2010-04-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.base/solib-display.exp (split solib): New.

--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1888,6 +1888,7 @@ display_uses_solib_p (const struct display *d,
 	{
 	  const struct block *const block = elts[i + 1].block;
 	  const struct symbol *const symbol = elts[i + 2].symbol;
+	  struct objfile *symbol_objfile;
 
 	  if (block != NULL
 	      && solib_contains_address_p (solib,
@@ -1895,7 +1896,11 @@ display_uses_solib_p (const struct display *d,
 	    return 1;
 
 	  /* SYMBOL_OBJ_SECTION (symbol) may be NULL.  */
-	  if (SYMBOL_SYMTAB (symbol)->objfile == solib->objfile)
+	  symbol_objfile = SYMBOL_SYMTAB (symbol)->objfile;
+	  if (solib->objfile
+	      && (symbol_objfile == solib->objfile
+		  || symbol_objfile->separate_debug_objfile_backlink
+		     == solib->objfile))
 	    return 1;
 	}
       endpos -= oplen;
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -64,7 +64,12 @@ struct so_list
     bfd *abfd;
     char symbols_loaded;	/* flag: symbols read in yet? */
     char from_tty;		/* flag: print msgs? */
-    struct objfile *objfile;	/* objfile for loaded lib */
+
+    /* objfile with symbols for a loaded library.  Target memory is read from
+       ABFD.  OBJFILE may be NULL either before symbols have been loaded or if
+       the file cannot be found.  */
+    struct objfile *objfile;
+
     struct target_section *sections;
     struct target_section *sections_end;
 
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -148,7 +148,7 @@ struct general_symbol_info
 
   short section;
 
-  /* The section associated with this symbol. */
+  /* The section associated with this symbol.  It can be NULL.  */
 
   struct obj_section *obj_section;
 };
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -53,6 +53,13 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
   return -1
 }
 
+set test "split solib"
+if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
+    fail $test
+} else {
+    pass $test
+}
+
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir


  reply	other threads:[~2010-04-09 20:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-03  9:56 Jan Kratochvil
2010-04-07 19:25 ` Tom Tromey
2010-04-09 15:30   ` Jan Kratochvil
2010-04-09 15:34     ` Pedro Alves
2010-04-09 15:53       ` Jan Kratochvil
2010-04-09 16:48         ` Pedro Alves
2010-04-09 20:01           ` Jan Kratochvil [this message]
2010-04-11  1:27             ` Pedro Alves
2010-04-19 14:25               ` Jan Kratochvil
2010-04-20 11:05                 ` Pedro Alves
2010-04-22 22:30                   ` Jan Kratochvil
2010-04-22 22:52                     ` Pedro Alves
2010-04-22 23:17                       ` Jan Kratochvil
2010-04-09 17:17       ` Tom Tromey

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=20100409200046.GA22709@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=tromey@redhat.com \
    /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