This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb: Fix riscv ARI issues
- From: Simon Marchi <simark at simark dot ca>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, gdb-patches at sourceware dot org
- Date: Thu, 8 Mar 2018 23:04:08 -0500
- Subject: Re: [PATCH] gdb: Fix riscv ARI issues
- Authentication-results: sourceware.org; auth=none
- References: <20180307224121.19941-1-andrew.burgess@embecosm.com>
Hi Andrew,
On top of what Sergio said:
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index 11b12279321..d84e7aba76a 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -481,7 +481,7 @@ riscv_register_name (struct gdbarch *gdbarch, int regnum)
> {
> static char buf[20];
>
> - sprintf (buf, "csr%d", regnum - RISCV_FIRST_CSR_REGNUM);
> + xsnprintf (buf, 20, "csr%d", regnum - RISCV_FIRST_CSR_REGNUM);
sizeof (buf) instead of hard-coding 20?
Thanks,
Simon