libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: [Libunwind-devel] Re: [patch] Implement _Unwind_GetIPInfo (GCC


From: Jan Kratochvil
Subject: Re: Fwd: [Libunwind-devel] Re: [patch] Implement _Unwind_GetIPInfo (GCC PR target/27880)
Date: Wed, 1 Apr 2009 19:58:28 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, 01 Apr 2009 17:24:08 +0200, David Mosberger-Tang wrote:
> That's correct.  The code/unwind-info is constructed such that the IP
> never needs to be adjusted to locate the right unwind-info.

Therefore providing this new patch which never adjusts IP on ia64.
non-ia64:
  *ip_before_insn = unw_is_signal_frame (&context->cursor);
ia64:
  *ip_before_insn = 1;


Thanks,
Jan


Signed-off-by: Jan Kratochvil <address@hidden>

diff --git a/include/unwind.h b/include/unwind.h
index 1f94a0d..d9a767d 100644
--- a/include/unwind.h
+++ b/include/unwind.h
@@ -88,6 +88,7 @@ extern void _Unwind_DeleteException (struct _Unwind_Exception 
*);
 extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int);
 extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long);
 extern unsigned long _Unwind_GetIP (struct _Unwind_Context *);
+extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
 extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long);
 extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*);
 extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *);
diff --git a/src/Makefile.am b/src/Makefile.am
index 883e019..8e9f342 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,7 +62,7 @@ libunwind_la_SOURCES_generic =                                
                \
        mi/Gset_caching_policy.c
 
 if SUPPORT_CXX_EXCEPTIONS
-libunwind_la_SOURCES_local_unwind =                                    \
+libunwind_la_SOURCES_local_unwind_noarch =                             \
        unwind/Backtrace.c unwind/DeleteException.c                     \
        unwind/FindEnclosingFunction.c unwind/ForcedUnwind.c            \
        unwind/GetBSP.c unwind/GetCFA.c unwind/GetDataRelBase.c         \
@@ -71,6 +71,14 @@ libunwind_la_SOURCES_local_unwind =                          
        \
        unwind/RaiseException.c unwind/Resume.c                         \
        unwind/Resume_or_Rethrow.c unwind/SetGR.c unwind/SetIP.c
 
+libunwind_la_SOURCES_local_unwind_ia64 =                               \
+       $(libunwind_la_SOURCES_local_unwind_noarch)                     \
+       ia64/unwind_GetIPInfo.c
+
+libunwind_la_SOURCES_local_unwind_nonia64 =                            \
+       $(libunwind_la_SOURCES_local_unwind_noarch)                     \
+       dwarf/unwind_GetIPInfo.c
+
 #  _ReadULEB()/_ReadSLEB() are needed for Intel C++ 8.0 compatibility
 libunwind_la_SOURCES_os_linux_local = mi/_ReadULEB.c mi/_ReadSLEB.c
 endif
@@ -98,9 +106,15 @@ if ARCH_MIPS
 libunwind_la_SOURCES_local =                                           \
        $(libunwind_la_SOURCES_local_nounwind)
 else
+if ARCH_IA64
 libunwind_la_SOURCES_local =                                           \
        $(libunwind_la_SOURCES_local_nounwind)                          \
-       $(libunwind_la_SOURCES_local_unwind)
+       $(libunwind_la_SOURCES_local_unwind_ia64)
+else
+libunwind_la_SOURCES_local =                                           \
+       $(libunwind_la_SOURCES_local_nounwind)                          \
+       $(libunwind_la_SOURCES_local_unwind_nonia64)
+endif # ARCH_IA64
 endif # ARCH_MIPS
 endif # ARCH_ARM
 
diff --git a/src/dwarf/unwind_GetIPInfo.c b/src/dwarf/unwind_GetIPInfo.c
new file mode 100644
index 0000000..c81db27
--- /dev/null
+++ b/src/dwarf/unwind_GetIPInfo.c
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+   Copyright (C) 2009 Red Hat
+       Contributed by Jan Kratochvil <address@hidden>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+
+#include "../unwind/unwind-internal.h"
+
+/* gcc/unwind-dw2.c: Retrieve the return address and flag whether that IP is
+   before or after first not yet fully executed instruction.  */
+
+PROTECTED unsigned long
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
+{
+  unw_word_t val;
+
+  unw_get_reg (&context->cursor, UNW_REG_IP, &val);
+  *ip_before_insn = unw_is_signal_frame (&context->cursor);
+  return val;
+}
+
+unsigned long __libunwind_Unwind_GetIPInfo (struct _Unwind_Context *, int *)
+     ALIAS (_Unwind_GetIPInfo);
diff --git a/src/ia64/unwind_GetIPInfo.c b/src/ia64/unwind_GetIPInfo.c
new file mode 100644
index 0000000..dfdf5e8
--- /dev/null
+++ b/src/ia64/unwind_GetIPInfo.c
@@ -0,0 +1,43 @@
+/* libunwind - a platform-independent unwind library
+   Copyright (C) 2009 Red Hat
+       Contributed by Jan Kratochvil <address@hidden>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+
+#include "../unwind/unwind-internal.h"
+
+/* gcc/unwind-dw2.c: Retrieve the return address and flag whether that IP is
+   before or after first not yet fully executed instruction.
+   IP_BEFORE_INSN ensures leaving IP intact as was designed for ia64.  */
+
+PROTECTED unsigned long
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
+{
+  unw_word_t val;
+
+  unw_get_reg (&context->cursor, UNW_REG_IP, &val);
+  *ip_before_insn = 1;
+  return val;
+}
+
+unsigned long __libunwind_Unwind_GetIPInfo (struct _Unwind_Context *, int *)
+     ALIAS (_Unwind_GetIPInfo);
diff --git a/tests/check-namespace.sh.in b/tests/check-namespace.sh.in
index 007ba43..66078a1 100644
--- a/tests/check-namespace.sh.in
+++ b/tests/check-namespace.sh.in
@@ -197,6 +197,7 @@ check_cxx_abi () {
     match _Unwind_GetDataRelBase
     match _Unwind_GetGR
     match _Unwind_GetIP
+    match _Unwind_GetIPInfo
     match _Unwind_GetLanguageSpecificData
     match _Unwind_GetRegionStart
     match _Unwind_GetTextRelBase
@@ -214,6 +215,7 @@ check_cxx_abi () {
     match __libunwind_Unwind_GetDataRelBase
     match __libunwind_Unwind_GetGR
     match __libunwind_Unwind_GetIP
+    match __libunwind_Unwind_GetIPInfo
     match __libunwind_Unwind_GetLanguageSpecificData
     match __libunwind_Unwind_GetRegionStart
     match __libunwind_Unwind_GetTextRelBase




reply via email to

[Prev in Thread] Current Thread [Next in Thread]