This is the mail archive of the gdb@sources.redhat.com 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: RFC: Variables in blocks of registers


If only it were that easy. The dwarf2 reader, for instance, also contains the assumption that registers are allocated sequentially.

Is the proposal to modify such readers so that they check against this next_allocated_regnum algorithm?

Andrew


Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.44
diff -u -p -r1.44 findvar.c
--- findvar.c 14 Jan 2003 00:49:03 -0000 1.44
+++ findvar.c 1 Feb 2003 22:29:45 -0000
@@ -753,17 +753,18 @@ value_from_register (struct type *type, for (local_regnum = regnum;
value_bytes_copied < len;
(value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
- ++local_regnum))
+ local_regnum = gdbarch_next_allocated_regnum (current_gdbarch,
+ local_regnum)))
{
+ if (local_regnum == -1)
+ return NULL; /* Register unknown. */
+
get_saved_register (value_bytes + value_bytes_copied,
- &optim,
- &addr,
- frame,
- local_regnum,
+ &optim, &addr, frame, local_regnum,
&lval);
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.89
diff -u -p -r1.89 valops.c
--- valops.c 30 Jan 2003 16:44:20 -0000 1.89
+++ valops.c 1 Feb 2003 22:29:47 -0000
@@ -704,13 +704,17 @@ value_assign (struct value *toval, struc
/* Copy it out. */
for (regno = reg_offset, amount_copied = 0;
amount_copied < amount_to_copy;
- amount_copied += REGISTER_RAW_SIZE (regno), regno++)
+ (amount_copied += REGISTER_RAW_SIZE (regno),
+ regno = gdbarch_next_allocated_regnum (current_gdbarch, regno)))
{
enum lval_type lval;
CORE_ADDR addr;
int optim;
int realnum;
- +
+ if (regno == -1)
+ error ("Location of variable is unknown.");
+
/* Just find out where to put it. */
frame_register (frame, regno, &optim, &lval, &addr, &realnum,
NULL);





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