The gssq instruction is a Loongson extended instruction, so the gssq patch
is applied to gdb.

Signed-off-by: Huacai Chen <chenhua...@loongson.cn>
Signed-off-by: Youling Tang <tangyoul...@loongson.cn>
---
 Makefile               |  3 +++
 configure.c            |  2 +-
 gdb-7.6-loongson.patch | 19 +++++++++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 gdb-7.6-loongson.patch

diff --git a/Makefile b/Makefile
index eb1e018..c629d17 100644
--- a/Makefile
+++ b/Makefile
@@ -277,6 +277,9 @@ gdb_patch:
                        patch -p0 < ${GDB}-proc_service.h.patch; \
                fi; \
        fi
+       if [ "${ARCH}" = "mips64" ] && [ -f ${GDB}-loongson.patch ]; then \
+               patch -d ${GDB} -p1 -F0 < ${GDB}-loongson.patch ; \
+       fi
 
 library: make_build_data ${OBJECT_FILES}
        ar -rs ${PROGRAM}lib.a ${OBJECT_FILES}
diff --git a/configure.c b/configure.c
index e2df6f0..40351c3 100644
--- a/configure.c
+++ b/configure.c
@@ -245,7 +245,7 @@ struct supported_gdb_version {
            "7.6",
            "GDB_FILES=${GDB_7.6_FILES}",
            "GDB_OFILES=${GDB_7.6_OFILES}",
-           "GDB_PATCH_FILES=gdb-7.6.patch gdb-7.6-ppc64le-support.patch 
gdb-7.6-proc_service.h.patch",
+           "GDB_PATCH_FILES=gdb-7.6.patch gdb-7.6-ppc64le-support.patch 
gdb-7.6-proc_service.h.patch gdb-7.6-loongson.patch",
            "GDB_FLAGS=-DGDB_7_6",
            "GPLv3"
        },
diff --git a/gdb-7.6-loongson.patch b/gdb-7.6-loongson.patch
new file mode 100644
index 0000000..556163f
--- /dev/null
+++ b/gdb-7.6-loongson.patch
@@ -0,0 +1,19 @@
+--- gdb-7.6/gdb/mips-tdep.c.orig       2018-08-28 11:20:32.653771170 +0800
++++ gdb-7.6/gdb/mips-tdep.c    2018-08-28 11:25:53.129043377 +0800
+@@ -3261,6 +3261,16 @@ restart:
+         /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra.  */
+         set_reg_offset (gdbarch, this_cache, reg, sp + low_word);
+       }
++      else if (((inst & 0xFFE08020) == 0xeba00020)    /* gssq 
reg,reg,offset($sp) */
++               && regsize_is_64_bits)
++      {
++        reg = (inst >> 16) & 0x1F;
++        low_word = ((((inst >> 6) & 0x1FF) ^ 0x100) - 0x100) << 4;
++        set_reg_offset (gdbarch, this_cache, reg, sp + low_word);
++        reg = inst & 0x1F;
++        low_word = (((((inst >> 6) & 0x1FF) ^ 0x100) - 0x100) << 4) + 8;
++        set_reg_offset (gdbarch, this_cache, reg, sp + low_word);
++      }
+       else if (high_word == 0x27be)   /* addiu $30,$sp,size */
+       {
+         /* Old gcc frame, r30 is virtual frame pointer.  */
-- 
2.1.0

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to