src/gdb ChangeLog psymtab.c symtab.c

brobecke@sourceware.org brobecke@sourceware.org
Thu Aug 19 09:12:00 GMT 2010


CVSROOT:	/cvs/src
Module name:	src
Branch: 	gdb_7_2-branch
Changes by:	brobecke@sourceware.org	2010-08-19 09:12:33

Modified files:
	gdb            : ChangeLog psymtab.c symtab.c 

Log message:
	Fix regression in -file-list-exec-source-files command.
	
	See http://sourceware.org/ml/gdb/2010-07/msg00118.html for
	a description of the problem. Namely, the file and fullname
	fields are inverted in the output of the -file-list-exec-source-files
	GDB/MI command:
	
	(gdb) interpreter-exec mi -file-list-exec-source-files
	^done,files=[{file="/takamaka.a/brobecke/ex/list-exec-source-files/foo.c",fullname="foo.c"},{file="/takamaka.a/brobecke/ex/list-exec-source-files/foo.c",fullname="foo.c"},{file="",fullname="init.c"},{file="",fullname="../sysdeps/x86_64/elf/start.S"},{file="",fullname="../sysdeps/x86_64/elf/start.S"}]
	
	It turns out to be a silly thinko: The map_symbol_filenames function
	calls the psymtab version of map_symbol_filenames routine, and this
	version called the callback function with filename and fullname
	in the wrong order (fullname/filename instead of filename/fullname).
	
	The routine description in symfile.h confirst that expected order for
	the FUN callback parameters:
	
	/* Call a callback for every file defined in OBJFILE.  FUN is the
	callback.  It is passed the file's name, the file's full name,
	and the DATA passed to this function.  */
	void (*map_symbol_filenames) (struct objfile *objfile,
	void (*fun) (const char *, const char *,
	void *),
	void *data);
	
	Fixing this error uncovered another location where the arguments
	were reversed: maybe_add_partial_symtab_filename.  Once the first
	error was fixed, the debugger would crash while attempting to do
	completion, because it was given a NULL fullname instead of the
	non-NULL filename.
	
	gdb/ChangeLog:
	
	* psymtab.c (map_symbol_filenames_psymtab): Call FUN with
	the arguments in the correct order.
	* symtab.c (maybe_add_partial_symtab_filename): Declare
	the arguments in the correct order.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.11973.2.31&r2=1.11973.2.32
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/psymtab.c.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/symtab.c.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.240&r2=1.240.2.1



More information about the Gdb-cvs mailing list