aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-01-08 17:34:12 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-01-08 17:34:12 +0000
commit00fa51f6801ada6b33763db75f5cdab6c74ea90b (patch)
tree5655c58c8bee2c41ad8d0a09542f3c3d05a38886 /gdb/frame.c
parent42037fe5bbb1bc401de372fca49768eeef2c21dc (diff)
downloadgdb-00fa51f6801ada6b33763db75f5cdab6c74ea90b.zip
gdb-00fa51f6801ada6b33763db75f5cdab6c74ea90b.tar.gz
gdb-00fa51f6801ada6b33763db75f5cdab6c74ea90b.tar.bz2
* frame.c (get_frame_register_bytes): New function.
(put_frame_register_bytes): Likewise. * frame.h (get_frame_register_bytes): Declare. (put_frame_register_bytes): Likewise. * findvar.c (value_from_register): Always construct lval_register values. Use get_frame_register_bytes. * valops.c (value_assign): Use get_frame_register_bytes and put_frame_register_bytes.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index f1b28f7..fcd8fdd 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -742,6 +742,84 @@ frame_register_read (struct frame_info *frame, int regnum,
return !optimized;
}
+int
+get_frame_register_bytes (struct frame_info *frame, int regnum,
+ CORE_ADDR offset, int len, gdb_byte *myaddr)
+{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+
+ /* Skip registers wholly inside of OFFSET. */
+ while (offset >= register_size (gdbarch, regnum))
+ {
+ offset -= register_size (gdbarch, regnum);
+ regnum++;
+ }
+
+ /* Copy the data. */
+ while (len > 0)
+ {
+ int curr_len = register_size (gdbarch, regnum) - offset;
+ if (curr_len > len)
+ curr_len = len;
+
+ if (curr_len == register_size (gdbarch, regnum))
+ {
+ if (!frame_register_read (frame, regnum, myaddr))
+ return 0;
+ }
+ else
+ {
+ gdb_byte buf[MAX_REGISTER_SIZE];
+ if (!frame_register_read (frame, regnum, buf))
+ return 0;
+ memcpy (myaddr, buf + offset, curr_len);
+ }
+
+ len -= curr_len;
+ offset = 0;
+ regnum++;
+ }
+
+ return 1;
+}
+
+void
+put_frame_register_bytes (struct frame_info *frame, int regnum,
+ CORE_ADDR offset, int len, const gdb_byte *myaddr)
+{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+
+ /* Skip registers wholly inside of OFFSET. */
+ while (offset >= register_size (gdbarch, regnum))
+ {
+ offset -= register_size (gdbarch, regnum);
+ regnum++;
+ }
+
+ /* Copy the data. */
+ while (len > 0)
+ {
+ int curr_len = register_size (gdbarch, regnum) - offset;
+ if (curr_len > len)
+ curr_len = len;
+
+ if (curr_len == register_size (gdbarch, regnum))
+ {
+ put_frame_register (frame, regnum, myaddr);
+ }
+ else
+ {
+ gdb_byte buf[MAX_REGISTER_SIZE];
+ frame_register_read (frame, regnum, buf);
+ memcpy (buf + offset, myaddr, curr_len);
+ put_frame_register (frame, regnum, buf);
+ }
+
+ len -= curr_len;
+ offset = 0;
+ regnum++;
+ }
+}
/* Map between a frame register number and its name. A frame register
space is a superset of the cooked register space --- it also