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 NEWS cp-valprint.c dwarf2loc ...


CVSROOT:	/cvs/src
Module name:	src
Changes by:	palves@sourceware.org	2013-10-02 16:15:46

Modified files:
	gdb            : ChangeLog NEWS cp-valprint.c dwarf2loc.c 
	                 findvar.c frame.c infcmd.c jv-valprint.c 
	                 p-valprint.c valprint.c valprint.h value.c 
	                 value.h 
	gdb/doc        : ChangeLog gdb.texinfo 
	gdb/mi         : mi-main.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.dwarf2: dw2-reg-undefined.exp 
	gdb/testsuite/gdb.mi: mi-reg-undefined.exp 

Log message:
	Print registers not saved in the frame as "<not saved>" instead of "<optimized out>".
	
	Currently, in some scenarios, GDB prints <optimized out> when printing
	outer frame registers.  An <optimized out> register is a confusing
	concept.  What this really means is that the register is
	call-clobbered, or IOW, not saved by the callee.  This patch makes GDB
	say that instead.
	
	Before patch:
	
	(gdb) p/x $rax $1 = <optimized out>
	(gdb) info registers rax
	rax            <optimized out>
	
	After patch:
	
	(gdb) p/x $rax
	$1 = <not saved>
	(gdb) info registers rax
	rax            <not saved>
	
	However, if for some reason the debug info describes a variable as
	being in such a register (**), we still want to print <optimized out>
	when printing the variable.  IOW, <not saved> is reserved for
	inspecting registers at the machine level.  The patch uses
	lval_register+optimized_out to encode the not saved registers, and
	makes it so that optimized out variables always end up in
	!lval_register values.
	
	** See <https://sourceware.org/ml/gdb-patches/2012-08/msg00787.html>.
	Current/recent enough GCC doesn't mark variables/arguments as being in
	call-clobbered registers in the ranges corresponding to function
	calls, while older GCCs did.  Newer GCCs will just not say where the
	variable is, so GDB will end up realizing the variable is optimized
	out.
	
	frame_unwind_got_optimized creates not_lval optimized out registers,
	so by default, in most cases, we'll see <optimized out>.
	
	value_of_register is the function eval.c uses for evaluating
	OP_REGISTER (again, $pc, etc.), and related bits.  It isn't used for
	anything else.  This function makes sure to return lval_register
	values.  The patch makes "info registers" and the MI equivalent use it
	too.  I think it just makes a lot of sense, as this makes it so that
	when printing machine registers ($pc, etc.), we go through a central
	function.
	
	We're likely to need a different encoding at some point, if/when we
	support partially saved registers.  Even then, I think
	value_of_register will still be the spot to tag the intention to print
	machine register values differently.
	
	value_from_register however may also return optimized out
	lval_register values, so at a couple places where we're computing a
	variable's location from a dwarf expression, we convert the resulting
	value away from lval_register to a regular optimized out value.
	
	Tested on x86_64 Fedora 17
	
	gdb/
	2013-10-02  Pedro Alves  <palves@redhat.com>
	
	* cp-valprint.c (cp_print_value_fields): Adjust calls to
	val_print_optimized_out.
	* jv-valprint.c (java_print_value_fields): Likewise.
	* p-valprint.c (pascal_object_print_value_fields): Likewise.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full)
	<DWARF_VALUE_REGISTER>: If the register was not saved, return a
	new optimized out value.
	* findvar.c (address_from_register): Likewise.
	* frame.c (put_frame_register): Tweak error string to say the
	register was not saved, rather than optimized out.
	* infcmd.c (default_print_one_register_info): Adjust call to
	val_print_optimized_out.  Use value_of_register instead of
	get_frame_register_value.
	* mi/mi-main.c (output_register): Use value_of_register instead of
	get_frame_register_value.
	* valprint.c (valprint_check_validity): Likewise.
	(val_print_optimized_out): New value parameter.  If the value is
	lval_register, print <not saved> instead.
	(value_check_printable, val_print_scalar_formatted): Adjust calls
	to val_print_optimized_out.
	* valprint.h (val_print_optimized_out): New value parameter.
	* value.c (struct value) <optimized_out>: Extend comment.
	(error_value_optimized_out): New function.
	(require_not_optimized_out): Use it.  Use a different string for
	lval_register values.
	* value.h (error_value_optimized_out): New declaration.
	* NEWS: Mention <not saved>.
	
	gdb/testsuite/
	2013-10-02  Pedro Alves  <palves@redhat.com>
	
	* gdb.dwarf2/dw2-reg-undefined.exp <pattern_rax_rbx_rcx_print,
	pattern_rax_rbx_rcx_info>: Set to "<not saved>".
	* gdb.mi/mi-reg-undefined.exp (opt_out_pattern): Delete.
	(not_saved_pattern): New.
	Replace use of the former with the latter.
	
	gdb/doc/
	2013-10-02  Pedro Alves  <palves@redhat.com>
	
	* gdb.texinfo (Registers): Expand description of saved registers
	in frames.  Explain <not saved>.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.16063&r2=1.16064
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/NEWS.diff?cvsroot=src&r1=1.616&r2=1.617
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/cp-valprint.c.diff?cvsroot=src&r1=1.91&r2=1.92
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2loc.c.diff?cvsroot=src&r1=1.178&r2=1.179
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/findvar.c.diff?cvsroot=src&r1=1.153&r2=1.154
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/frame.c.diff?cvsroot=src&r1=1.319&r2=1.320
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/infcmd.c.diff?cvsroot=src&r1=1.336&r2=1.337
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/jv-valprint.c.diff?cvsroot=src&r1=1.67&r2=1.68
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/p-valprint.c.diff?cvsroot=src&r1=1.107&r2=1.108
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/valprint.c.diff?cvsroot=src&r1=1.139&r2=1.140
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/valprint.h.diff?cvsroot=src&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/value.c.diff?cvsroot=src&r1=1.184&r2=1.185
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/value.h.diff?cvsroot=src&r1=1.226&r2=1.227
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/ChangeLog.diff?cvsroot=src&r1=1.1491&r2=1.1492
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/gdb.texinfo.diff?cvsroot=src&r1=1.1113&r2=1.1114
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/mi/mi-main.c.diff?cvsroot=src&r1=1.242&r2=1.243
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3821&r2=1.3822
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.mi/mi-reg-undefined.exp.diff?cvsroot=src&r1=1.1&r2=1.2


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