aboutsummaryrefslogtreecommitdiff
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
commit538155bd6a8027551dd9281a8d636c2e6d2a12a5 (patch)
tree202396bf9997fcbf0f38a7fd6936a8448a720c27 /gdb/parse.c
parent8554b7d530743b6f61cf27f58167e1a8d6699f43 (diff)
downloadgdb-538155bd6a8027551dd9281a8d636c2e6d2a12a5.zip
gdb-538155bd6a8027551dd9281a8d636c2e6d2a12a5.tar.gz
gdb-538155bd6a8027551dd9281a8d636c2e6d2a12a5.tar.bz2
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 166446a..5ea0534 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]));
}