This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] microMIPS: Add SYSCALL instruction decoding
- From: Maciej W.Rozycki <macro at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 18 Jul 2018 18:19:10 -0000
- Subject: [binutils-gdb] microMIPS: Add SYSCALL instruction decoding
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6592ceed489043051d02d41dc71f51e8ef8aa6f0
commit 6592ceed489043051d02d41dc71f51e8ef8aa6f0
Author: Maciej W. Rozycki <macro@mips.com>
Date: Wed Jul 18 19:17:39 2018 +0100
microMIPS: Add SYSCALL instruction decoding
Fix a bug with commit 4cc0665f24bb ("microMIPS support"),
<https://sourceware.org/ml/gdb-patches/2012-05/msg00724.html>, and add
missing microMIPS SYSCALL instruction decoding needed to determine the
location to put a breakpoint at when single-stepping though a syscall.
gdb/
* mips-tdep.c (micromips_next_pc): Add SYSCALL instruction
decoding.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/mips-tdep.c | 30 ++++++++++++++++++++++++------
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7e7f88a..a30780a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-18 Maciej W. Rozycki <macro@mips.com>
+
+ * mips-tdep.c (micromips_next_pc): Add SYSCALL instruction
+ decoding.
+
2018-07-17 Tom Tromey <tom@tromey.com>
* guile/scm-param.c (pascm_set_func, pascm_show_func)
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 36fae02..37a12a9 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1898,12 +1898,30 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
switch (micromips_op (insn >> 16))
{
case 0x00: /* POOL32A: bits 000000 */
- if (b0s6_op (insn) == 0x3c
- /* POOL32Axf: bits 000000 ... 111100 */
- && (b6s10_ext (insn) & 0x2bf) == 0x3c)
- /* JALR, JALR.HB: 000000 000x111100 111100 */
- /* JALRS, JALRS.HB: 000000 010x111100 111100 */
- pc = regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16));
+ switch (b0s6_op (insn))
+ {
+ case 0x3c: /* POOL32Axf: bits 000000 ... 111100 */
+ switch (b6s10_ext (insn))
+ {
+ case 0x3c: /* JALR: 000000 0000111100 111100 */
+ case 0x7c: /* JALR.HB: 000000 0001111100 111100 */
+ case 0x13c: /* JALRS: 000000 0100111100 111100 */
+ case 0x17c: /* JALRS.HB: 000000 0101111100 111100 */
+ pc = regcache_raw_get_signed (regcache,
+ b0s5_reg (insn >> 16));
+ break;
+ case 0x22d: /* SYSCALL: 000000 1000101101 111100 */
+ {
+ struct gdbarch_tdep *tdep;
+
+ tdep = gdbarch_tdep (gdbarch);
+ if (tdep->syscall_next_pc != NULL)
+ pc = tdep->syscall_next_pc (get_current_frame ());
+ }
+ break;
+ }
+ break;
+ }
break;
case 0x10: /* POOL32I: bits 010000 */