aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-03-18 18:42:41 +0000
committerPedro Alves <palves@redhat.com>2011-03-18 18:42:41 +0000
commit8dccd430c9de0e6cf747ae4bb1bf9d944fe3397c (patch)
treef08c75005e0a84b4ea64218341df6caf2bca0799 /gdb/dwarf2loc.c
parent0fdb4f184b39af02d76e21cd25af561b464f15a6 (diff)
downloadgdb-8dccd430c9de0e6cf747ae4bb1bf9d944fe3397c.zip
gdb-8dccd430c9de0e6cf747ae4bb1bf9d944fe3397c.tar.gz
gdb-8dccd430c9de0e6cf747ae4bb1bf9d944fe3397c.tar.bz2
gdb/
* dwarf2loc.c (read_pieced_value): Handle get_frame_register_bytes returning that the register piece is unavailable/optimized out. (write_pieced_value): Handle get_frame_register_bytes returning that the register piece is unavailable/optimized out when doing a read-modify write of a bitfield. * findvar.c (value_from_register): Handle get_frame_register_bytes returning that the register piece is unavailable/optimized out. * frame.c (get_frame_register_bytes): New parameters `optimizedp' and `unavailablep'. Throw error on bad debug info. Use frame_register instead of frame_register_read, to fill in the new arguments. * frame.h (get_frame_register_bytes): New parameters `optimizedp' and `unavailablep'. * valops.c: (value_assign): Adjust, and handle get_frame_register_bytes failing. * spu-tdep.c: Include exceptions.h. (spu_software_single_step): Adjust, and handle get_frame_register_bytes failing. (spu_get_longjmp_target): Ditto. * gdbarch.sh (register_to_value): Change to return int. New parameters `optimizedp' and `unavailablep'. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.c (i386_register_to_value): Adjust to new gdbarch_register_to_value interface. * i387-tdep.c (i387_register_to_value): Ditto. * i387-tdep.h (i387_register_to_value): Ditto. * alpha-tdep.c (alpha_register_to_value): Ditto. * ia64-tdep.c (ia64_register_to_value): Ditto. * m68k-tdep.c (m68k_register_to_value): Ditto. * mips-tdep.c (mips_register_to_value): Ditto. * rs6000-tdep.c (rs6000_register_to_value): Ditto.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index f90ee71..285081e 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -591,8 +591,20 @@ read_pieced_value (struct value *v)
if (gdb_regnum != -1)
{
- get_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, buffer);
+ int optim, unavail;
+
+ if (!get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ this_size, buffer,
+ &optim, &unavail))
+ {
+ /* Just so garbage doesn't ever shine through. */
+ memset (buffer, 0, this_size);
+
+ if (optim)
+ set_value_optimized_out (v, 1);
+ if (unavail)
+ mark_value_bytes_unavailable (v, offset, this_size);
+ }
}
else
{
@@ -776,8 +788,22 @@ write_pieced_value (struct value *to, struct value *from)
{
if (need_bitwise)
{
- get_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, buffer);
+ int optim, unavail;
+
+ if (!get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ this_size, buffer,
+ &optim, &unavail))
+ {
+ if (optim)
+ error (_("Can't do read-modify-write to "
+ "update bitfield; containing word has been "
+ "optimized out"));
+ if (unavail)
+ throw_error (NOT_AVAILABLE_ERROR,
+ _("Can't do read-modify-write to update "
+ "bitfield; containing word "
+ "is unavailable"));
+ }
copy_bitwise (buffer, dest_offset_bits,
contents, source_offset_bits,
this_size_bits,