This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

src/gdb ChangeLog ada-lang.c


CVSROOT:	/cvs/src
Module name:	src
Changes by:	brobecke@sourceware.org	2012-02-29 19:35:38

Modified files:
	gdb            : ChangeLog ada-lang.c 

Log message:
	[Ada] Do not cache lookup result if not full_search
	
	The ada_lookup_symbol_list function has recently been changed to accept
	a "full_search" parameter. When null, this parameter instructs the
	function to perform a partial search (global and static symbols are not
	searched). When doing a partial search, the result should not be saved
	into the lookup cache, as the result might be incomplete.
	
	This manifested itself when trying to perform a function call on AVR
	after having inserted a breakpoint inside that function:
	
	(gdb) b same
	Breakpoint 2 at 0x78: file r.adb, line 5.
	(gdb) call same(42)
	
	Breakpoint 2, r.same (i=42) at r.adb:5
	5             return I;
	The program being debugged stopped while in a function called from GDB.
	Evaluation of the expression containing the function
	(at 0x0x800068) will be abandoned.
	^^^^^^^^^^^^^^^
	When the function is done executing, GDB will silently stop.
	
	The expected output for the underlined portion is "(r.same)".
	
	What happens is that the breakpoint command triggers 3 lookups of the
	name "same":
	1. full search in LABEL_DOMAIN -> no match, cached;
	2. full search in VAR_DOMAIN -> 1 match, cached;
	3. partial search in VAR_DOMAIN -> no match, cached.
	
	The third lookup therefore causes the results of the partial search
	to be cached, thus overriding the result of the full search lookup.
	
	During the following command, the reference to "same" triggers a lookup
	of that symbol again. And since GDB CAN find the result of that lookup
	in the cache, it returns just that, which is: No match. (wrong!)
	
	As a result, we fallback on the symbol table to resolve the lookup.
	And instead of pushing an OP_VAR_VALUE subexpression for symbol "same",
	the parser ends up pushing an UNOP_MEMVAL subexpression using the value
	of the minimal symbol. This is where being on AVR becomes important:
	addresses on AVR are modular types, and if GDB thinks an address is
	a data address, it converts it.
	
	This is where one notices the fact that the breakpoint was inserted
	at 0x78, and yet GDB says that the function we stopped at is at
	0x0x800068...
	
	This patch fixes the problem by making sure we only cache the result
	of full searches.
	
	gdb/ChangeLog:
	
	* ada-lang.c (ada_lookup_symbol_list): Only cache the result of
	full searches.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13884&r2=1.13885
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.341&r2=1.342


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]