summaryrefslogtreecommitdiff
path: root/gdb/user-regs.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/user-regs.c')
-rw-r--r--gdb/user-regs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 4bc4685387..05bb04ef2e 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -74,15 +74,15 @@ append_user_reg (struct gdb_user_regs *regs, const char *name,
reg->xread = xread;
reg->baton = baton;
reg->next = NULL;
+ if (regs->last == nullptr)
+ regs->last = &regs->first;
(*regs->last) = reg;
regs->last = &(*regs->last)->next;
}
/* An array of the builtin user registers. */
-static struct gdb_user_regs builtin_user_regs = {
- NULL, &builtin_user_regs.first
-};
+static struct gdb_user_regs builtin_user_regs;
void
user_reg_add_builtin (const char *name, user_reg_read_ftype *xread,