mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00
gdb/riscv: Fix some ARI issues
Fix some ARI issues in recently added riscv code, the ARI email is: https://sourceware.org/ml/gdb-patches/2018-03/msg00156.html gdb/ChangeLog: * riscv-tdep.c (riscv_sw_breakpoint_from_kind): Add localization to error message string. (riscv_register_name): Use xsnprintf instead of sprintf. (riscv_insn::fetch_instruction): Use gdb_assert instead of internal_error. (riscv_print_arg_location): Use gdb_assert_not_reached instead of error. (riscv_push_dummy_call): Likewise.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2018-03-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
|
* riscv-tdep.c (riscv_sw_breakpoint_from_kind): Add localization
|
||||||
|
to error message string.
|
||||||
|
(riscv_register_name): Use xsnprintf instead of sprintf.
|
||||||
|
(riscv_insn::fetch_instruction): Use gdb_assert instead of
|
||||||
|
internal_error.
|
||||||
|
(riscv_print_arg_location): Use gdb_assert_not_reached instead of
|
||||||
|
error.
|
||||||
|
(riscv_push_dummy_call): Likewise.
|
||||||
|
|
||||||
2018-03-12 Tom Tromey <tom@tromey.com>
|
2018-03-12 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* rs6000-aix-tdep.c (rs6000_aix_core_xfer_shared_libraries_aix):
|
* rs6000-aix-tdep.c (rs6000_aix_core_xfer_shared_libraries_aix):
|
||||||
|
@ -446,7 +446,7 @@ riscv_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
|||||||
case 4:
|
case 4:
|
||||||
return ebreak;
|
return ebreak;
|
||||||
default:
|
default:
|
||||||
gdb_assert_not_reached ("unhandled breakpoint kind");
|
gdb_assert_not_reached (_("unhandled breakpoint kind"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +481,8 @@ riscv_register_name (struct gdbarch *gdbarch, int regnum)
|
|||||||
{
|
{
|
||||||
static char buf[20];
|
static char buf[20];
|
||||||
|
|
||||||
sprintf (buf, "csr%d", regnum - RISCV_FIRST_CSR_REGNUM);
|
xsnprintf (buf, sizeof (buf), "csr%d",
|
||||||
|
regnum - RISCV_FIRST_CSR_REGNUM);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,12 +1050,10 @@ riscv_insn::fetch_instruction (struct gdbarch *gdbarch,
|
|||||||
|
|
||||||
/* If we need more, grab it now. */
|
/* If we need more, grab it now. */
|
||||||
instlen = riscv_insn_length (buf[0]);
|
instlen = riscv_insn_length (buf[0]);
|
||||||
|
gdb_assert (instlen <= sizeof (buf));
|
||||||
*len = instlen;
|
*len = instlen;
|
||||||
if (instlen > sizeof (buf))
|
|
||||||
internal_error (__FILE__, __LINE__,
|
if (instlen > 2)
|
||||||
_("%s: riscv_insn_length returned %i"),
|
|
||||||
__func__, instlen);
|
|
||||||
else if (instlen > 2)
|
|
||||||
{
|
{
|
||||||
status = target_read_memory (addr + 2, buf + 2, instlen - 2);
|
status = target_read_memory (addr + 2, buf + 2, instlen - 2);
|
||||||
if (status)
|
if (status)
|
||||||
@ -2009,7 +2008,7 @@ riscv_print_arg_location (ui_file *stream, struct gdbarch *gdbarch,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error ("unknown argument location type");
|
gdb_assert_not_reached (_("unknown argument location type"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2149,7 +2148,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error ("unknown argument location type");
|
gdb_assert_not_reached (_("unknown argument location type"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (second_arg_length > 0)
|
if (second_arg_length > 0)
|
||||||
|
Reference in New Issue
Block a user