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 c-lang.c d-lang.c ...


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

Modified files:
	gdb            : ChangeLog ada-lang.c c-lang.c d-lang.c f-lang.c 
	                 findvar.c jv-lang.c language.c language.h 
	                 m2-lang.c objc-lang.c opencl-lang.c p-lang.c 
	                 value.h 

Log message:
	language-specific read_var_value for Ada renamings
	
	The purpose of this patch is to better support renamings in the
	"info locals" command. Consider ...
	
	procedure Foo is
	GV : Integer renames Pck.Global_Variable;
	begin
	Increment (GV); -- STOP
	end Foo;
	
	... Pck.Global_Variable is just an integer. After having stopped at
	the "STOP" line, "info locals" yields:
	
	(gdb) info locals
	gv = <error reading variable gv (Cannot access memory at address 0xffffffffffffffff)>
	
	In reality, two things are happening:
	
	(1) Variable "GV" does not exist, which is normal, since there is
	"GV" the renaming of another variable;
	
	(2) But to allow the user access to that renaming the same way
	the code has, the compiler produces an artificial variable
	whose name encodes the renaming:
	
	gv___XR_pck__global_variable___XE
	
	For practical reasons, the artificial variable itself is given
	irrelevant types and addresses.
	
	But the "info locals" command does not act as if it was a short-cut
	of "foreach VAR in locals, print VAR". Instead it gets the value of
	each VAR directly, which does not work in this case, since the variable
	is artificial and needs to be decoded first.
	
	This patch makes the "read_var_value" routine language-specific.
	The old implementation of "read_var_value" gets renamed to
	"default_read_var_value" and all languages now use it (unchanged
	behavior), except for Ada. In Ada, the new function ada_read_var_value
	checks if we have a renaming, and if so, evaluates its value, or else
	defers to default_read_var_value.
	
	gdb/ChangeLog:
	
	* language.h (struct language_defn): New "method" la_read_var_value.
	* findvar.c: #include "language.h".
	(default_read_var_value): Renames read_var_value.  Rewrite
	function description.
	(read_var_value): New function.
	* value.h (default_read_var_value): Add prototype.
	* ada-lang.c (ada_read_renaming_var_value, ada_read_var_value):
	New functions.
	(ada_language_defn): Add entry for la_read_var_value.
	* c-lang.c, d-lang.c, f-lang.c, jv-lang.c, language.c,
	* m2-lang.c, objc-lang.c, opencl-lang.c, p-lang.c: Update
	language_defn structures to add entry for new la_read_var_value
	field.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13939&r2=1.13940
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.348&r2=1.349
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/c-lang.c.diff?cvsroot=src&r1=1.99&r2=1.100
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/d-lang.c.diff?cvsroot=src&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/f-lang.c.diff?cvsroot=src&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/findvar.c.diff?cvsroot=src&r1=1.141&r2=1.142
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/jv-lang.c.diff?cvsroot=src&r1=1.100&r2=1.101
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/language.c.diff?cvsroot=src&r1=1.110&r2=1.111
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/language.h.diff?cvsroot=src&r1=1.81&r2=1.82
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/m2-lang.c.diff?cvsroot=src&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/objc-lang.c.diff?cvsroot=src&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/opencl-lang.c.diff?cvsroot=src&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/p-lang.c.diff?cvsroot=src&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/value.h.diff?cvsroot=src&r1=1.197&r2=1.198


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