This is the mail archive of the gdb-patches@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]

Re: [patch] fix pre-/post- in-/decrement


On Mon, Oct 04, 2010 at 09:46:50PM +0200, Ken Werner wrote:
> The attached patch introduces a new function called value_non_lval that 
> returns a non-lval version of the given value. This function is called prior 
> the simple assignment, compound assignment and pre/postfix routines return. Any 
> comments are appreciated.

I think this will have an undesired effect.

Try this - it's easiest to see what's going on with set debug target
1, or else by using gdbserver and set debug remote 1 (the latter is
easier for me to read).  I've edited out some reads relating to the
stack frame.

(gdb) set $p = (int *) $sp
(gdb) p *$p
Sending packet: $m7fffffffdff0,4#2e...Packet received: 01000000
$4 = 1
(gdb) set *$p = 2
Sending packet: $X7fffffffdff0,4:\002\000\000\000#55...Packet received: OK
(gdb) print *$p = 1
Sending packet: $X7fffffffdff0,4:\001\000\000\000#54...Packet received: OK
Sending packet: $m7fffffffdff0,4#2e...Packet received: 01000000
$5 = 1
(gdb)

I suspect that your patch will be called to handle the value_assign
for the set command, and it will result in an unnecessary read from
the target.  You want the resulting value to be unwritable, but it can
still be lazy; you don't need the value.

Of course, those two things are not orthogonal in GDB's current
representation.  So I don't know how to do this.  But don't break the
current behavior, please - it's important both for performance and for
embedded correctness.

-- 
Daniel Jacobowitz
CodeSourcery


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