[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libunwind-devel] A modification suggestion on MIPS64 N32 on libunwi
From: |
Deng, Yimin (NSB - CN/Shanghai) |
Subject: |
Re: [Libunwind-devel] A modification suggestion on MIPS64 N32 on libunwind |
Date: |
Wed, 18 Apr 2018 03:12:45 +0000 |
Hello,
I'm sorry for that. Thanks for your reminding!
Rebased (B.T.W. I have only N32 setup, so I'm not so sure whether it will
affect other ABIs):
diff --git a/include/libunwind-mips.h b/include/libunwind-mips.h
--- a/include/libunwind-mips.h
+++ b/include/libunwind-mips.h
@@ -98,7 +98,7 @@ typedef enum
UNW_MIPS_R30,
UNW_MIPS_R31,
- UNW_MIPS_PC = 34,
+ UNW_MIPS_PC = 64,
/* FIXME: Other registers! */
diff --git a/include/tdep-mips/libunwind_i.h b/include/tdep-mips/libunwind_i.h
--- a/include/tdep-mips/libunwind_i.h
+++ b/include/tdep-mips/libunwind_i.h
@@ -247,6 +247,14 @@ dwarf_get (struct dwarf_cursor *c, dwarf
0, c->as_arg);
else if (c->as->abi == UNW_MIPS_ABI_O32)
return read_s32 (c, DWARF_GET_LOC (loc), val);
+ else if (c->as->abi == UNW_MIPS_ABI_N32) {
+ if (tdep_big_endian(c->as))
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc) + 4, val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ }
else
return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
0, c->as_arg);
diff --git a/src/mips/Gcreate_addr_space.c b/src/mips/Gcreate_addr_space.c
--- a/src/mips/Gcreate_addr_space.c
+++ b/src/mips/Gcreate_addr_space.c
@@ -58,7 +58,15 @@ unw_create_addr_space (unw_accessors_t *
as->big_endian = (byte_order == __BIG_ENDIAN);
/* FIXME! There is no way to specify the ABI. */
+#if _MIPS_SIM == _ABIO32
as->abi = UNW_MIPS_ABI_O32;
+#elif _MIPS_SIM == _ABIN32
+ as->abi = UNW_MIPS_ABI_N32;
+#elif _MIPS_SIM == _ABI64
+ as->abi = UNW_MIPS_ABI_N64;
+#else
+# error Unsupported ABI
+#endif
as->addr_size = 4;
return as;
diff --git a/src/mips/Gregs.c b/src/mips/Gregs.c
--- a/src/mips/Gregs.c
+++ b/src/mips/Gregs.c
@@ -63,7 +63,7 @@ tdep_access_reg (struct cursor *c, unw_r
case UNW_MIPS_R26:
case UNW_MIPS_R27:
case UNW_MIPS_R28:
- case UNW_MIPS_R29:
+
case UNW_MIPS_R30:
case UNW_MIPS_R31:
loc = c->dwarf.loc[reg - UNW_MIPS_R0];
@@ -75,6 +75,7 @@ tdep_access_reg (struct cursor *c, unw_r
loc = c->dwarf.loc[reg];
break;
+ case UNW_MIPS_R29:
case UNW_MIPS_CFA:
if (write)
return -UNW_EREADONLYREG;
B.R.
Yimin Deng
-----Original Message-----
From: Dave Watson [mailto:address@hidden
Sent: 2018年4月17日 22:57
To: Deng, Yimin (NSB - CN/Shanghai)
Cc: address@hidden
Subject: Re: [Libunwind-devel] A modification suggestion on MIPS64 N32 on
libunwind
Hello,
On 04/16/18 07:15 AM, Deng, Yimin (NSB - CN/Shanghai) wrote:
> Hi,
> I really appreciate for all your contribution to the libunwind. I mainly used
> the library 'unwind-ptrace' and it's very useful.
>
> But I find that there are some issues when use it on MIPS64 (ABI: N32). After
> doing the modifications(based on libunwind-1.2.1) below, it works well.
> I hope this will help you if you are suffering issues on the same arch and
> ABI.
It appears parts of this patch have already been added to master. Can you
rebase this on top of the master branch and resend? Thanks!