summaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorDavid Taylor <taylor@redhat.com>2000-08-07 14:27:36 +0000
committerDavid Taylor <taylor@redhat.com>2000-08-07 14:27:36 +0000
commit6545628314a74371a0d32d9285c8f596813be397 (patch)
tree4311644e24467424809eeb3baade01135c36597c /gdb/parse.c
parent400e89a03a9ae4b046be426791b82d734c45fc64 (diff)
downloadgdb-6545628314a74371a0d32d9285c8f596813be397.tar.gz
parse.c (build_parse): don't write off the end of the std_regs array.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 166446a4016..5ea053459ca 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1331,24 +1331,36 @@ build_parse (void)
i = 0;
/* fill it in */
#ifdef PC_REGNUM
- std_regs[i].name = "pc";
- std_regs[i].regnum = PC_REGNUM;
- i++;
+ if (PC_REGNUM >= 0)
+ {
+ std_regs[i].name = "pc";
+ std_regs[i].regnum = PC_REGNUM;
+ i++;
+ }
#endif
#ifdef FP_REGNUM
- std_regs[i].name = "fp";
- std_regs[i].regnum = FP_REGNUM;
- i++;
+ if (FP_REGNUM >= 0)
+ {
+ std_regs[i].name = "fp";
+ std_regs[i].regnum = FP_REGNUM;
+ i++;
+ }
#endif
#ifdef SP_REGNUM
- std_regs[i].name = "sp";
- std_regs[i].regnum = SP_REGNUM;
- i++;
+ if (SP_REGNUM >= 0)
+ {
+ std_regs[i].name = "sp";
+ std_regs[i].regnum = SP_REGNUM;
+ i++;
+ }
#endif
#ifdef PS_REGNUM
- std_regs[i].name = "ps";
- std_regs[i].regnum = PS_REGNUM;
- i++;
+ if (PS_REGNUM >= 0)
+ {
+ std_regs[i].name = "ps";
+ std_regs[i].regnum = PS_REGNUM;
+ i++;
+ }
#endif
memset (&std_regs[i], 0, sizeof (std_regs[i]));
}