[PATCH] gdb: Fix riscv ARI issues

Simon Marchi simark@simark.ca
Fri Mar 9 04:04:00 GMT 2018


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



More information about the Gdb-patches mailing list