This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix dangling displays in separate debug
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