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 findvar.c


CVSROOT:	/cvs/src
Module name:	src
Changes by:	palves@sourceware.org	2013-09-05 14:02:16

Modified files:
	gdb            : ChangeLog findvar.c 

Log message:
	Rework value_of_register in terms of value_of_register_lazy.
	
	I noticed that value_of_register (used for getting values _of_
	registers ($pc, $rax, etc.), rather than variables _in_ registers),
	kind of builds a franken-value, by propagating the lval and address of
	the frame register value, but not the entire location, like necessary
	for lval_computed (if some unwinder ever returns that, the resulting
	value will misbehave).  This gets in the way of printing optimized out
	(not saved) lval_registers differently from other optimized out
	values, as it doesn't make sure the resulting value is lval_register.
	
	I started out by just doing something like:
	
	-  VALUE_LVAL (reg_val) = lval;
	-  set_value_address (reg_val, addr);
	+  VALUE_LVAL (reg_val) = lval_register;
	
	... just like value_of_register_lazy below.  That's sufficient to fix
	the issue.
	
	Then I noticed this is using frame_register, which we should avoid
	nowadays, for it returns elements of a value, but not all that's
	sometimes necessary (unavailable-ness is all or nothing with it, for
	instance), and considered using get_frame_register_value instead
	(which returns a struct value), and value_contents_copy, just like
	value_fetch_lazy's handling of lval_register.  But at that point, I
	realized we might as well just defer all that work to
	value_of_register_lazy/value_fetch_lazy...
	
	Doing it this way adds a frame_find_by_id lookup (from within
	value_fetch_lazy), while we already have a frame pointer handy in
	value_of_register.  I considered factoring out the lazy register
	fetching out of value_fetch_lazy, into a function that takes a frame
	pointer and call that instead, avoiding the lookup, but then it looked
	like too much complication for an early optimization, and went back to
	keeping it simple.
	
	Tested on x86_64 Fedora 17.
	
	gdb/
	2013-09-05  Pedro Alves  <palves@redhat.com>
	
	* findvar.c (value_of_register): Rework in terms of
	value_of_register_lazy.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15976&r2=1.15977
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/findvar.c.diff?cvsroot=src&r1=1.152&r2=1.153


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