-file-list-exec-source-files && libraries

Jim Blandy jimb@redhat.com
Tue Jun 15 22:53:00 GMT 2004

Bob Rossi <bob@brasko.net> writes:

> On Fri, Jun 11, 2004 at 02:29:16PM -0400, Bob Rossi wrote:
> > Hi,
> > 
> > A user of -file-list-exec-source-files noticed that this command does
> > not initially list the files that are in a library. For example,
> > 
> > I have
> >    $ ls
> >    Makefile  lib.c  lib.h  lib.o  libmilib.a  main  main.c
> > 
> > And
> >    $ cat Makefile
> >    all:
> >       gcc -c -g -Wall lib.c
> >       ar cru libmilib.a lib.o
> >       gcc -g -Wall main.c -o main -L. -lmilib -I.
> > 
> > When I do -file-list-exec-source-files originally, it doesn't show
> > lib.c, after I do 'list lib.c:1' it will then show the filename. Also, I
> > believe it shows all of the filenames in the library. 
> > 
> > My question is, is there any way to get this funcionality from the get
> > go? Load the psymtabs for all the libraries?
> > 
> > Or is there a GDB command that forces loading all symbols into the
> > partial symbol table at start?
> Unfortunatly, I forgot to add one thing. The files from all libraries do
> show up when the stabs debugging format is used. It seems like this is a
> dwarf2 problem. Anyone know if this is a bug?
> Or something maybe I could look into?

Hmm.  The partial symbol tables ought to be listing every source file
mentioned in the program.  Otherwise, when a user refers to a source
file by name (say, to set a breakpoint), GDB won't be able to tell
which compilation units' symbols to read in.

Dwarf 2 used to have a problem with this, but the following change
fixed that problem:

2004-05-03  J. Brobecker  <brobecker@gnat.com>

	* dwarf2read.c (line_header): Add new included_p field in
	field file_names.
	(partial_die_info): New field has_stmt_list. New field line_offset.
	(dwarf2_create_include_psymtab): New function.
	(dwarf2_build_include_psymtabs): New function.
	(add_file_name): Add forward declaration. Initialize new field.
	(dwarf_decode_lines): Add new parameter. Enhance this procedure
	to be able to determine the list of files included by the
	given unit, and build their associated psymtabs.
	(dwarf2_build_psymtabs_hard): Build the psymtabs for the included
	files as well.
	(psymtab_to_symtab_1): Build the symtabs of all dependencies as well.
	(read_file_scope): Update call to dwarf_decode_lines.
	(read_partial_die): Handle DW_AT_stmt_list attributes.

So, does 'readelf -wl main' mention all the source files?  It should.

Does 'maint info psymtabs' mention all the source files?  It should,

More information about the Gdb mailing list