aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 0f46e53..855947d 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -927,6 +927,12 @@ address_from_register (int regnum, struct frame_info *frame)
struct type *type = builtin_type (gdbarch)->builtin_data_ptr;
struct value *value;
CORE_ADDR result;
+ int regnum_max_excl = (gdbarch_num_regs (gdbarch)
+ + gdbarch_num_pseudo_regs (gdbarch));
+
+ if (regnum < 0 || regnum >= regnum_max_excl)
+ error (_("Invalid register #%d, expecting 0 <= # < %d"), regnum,
+ regnum_max_excl);
/* This routine may be called during early unwinding, at a time
where the ID of FRAME is not yet known. Calling value_from_register