The attached patch merges the lval_register and lval_reg_frame_relative store-register code. It now treads lval_register just like lval_reg_frame_relative only the former always applies to the current (inner most) frame.
As a bonus, the merge manages to eliminate any calls to the functions write_register_bytes(), read_register_bytes(), and get_saved_register() in tha file.
But wait, there's more! The patch adds tests to check that GDB can actually store a value correctly in a target register.
And if you test the patch in the next 15 minutes, the merge will also fix the very long standing bug where GDB would occasionally loose the selected frame:
(gdb) up
10 v = v + v;
(gdb) print v
$1 = 10
(gdb) set variable v = 20
(gdb) print v
No symbol "v" in current context.
(gdb) down
Bottom (i.e., innermost) frame selected; you cannot go down.
(gdb) up
10 v = v + v;
(gdb) print v
$2 = 20
The code now restores the selected frame after the frame-cache flush.
I'll look to commit the valops.c patch in a few days (it depends on an earlier frame_register() patch).
Fernando,
the new store.{exp,c} test cases? The tests fail without this patch and pass with the patch applied.
Andrew
2002-11-01 Andrew Cagney <cagney@redhat.com>
* valops.c (value_assign): Merge lval_register case into
lval_reg_frame_relative. Use frame_register and
regcache_cooked_write instead of get_saved_register and
write_register_bytes. After flushing the register cache, try to
re-select the selected frame.
Index: testsuite/ChangeLog
2002-11-02 Andrew Cagney <ac131313@redhat.com>
* gdb.base/store.exp, gdb.base/store.c: New files.