This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Unwinder improvements.


Hi all,
the attached patch adds a new function _Unwind_GetGRAddr()' to the unwinder. Having it there is necessary when doing a backtrace from the application to prevent a segfault in _Unwind_GetGR if requesting unsaved register.


OK to apply?

Michal Ludvig
--
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
2003-05-07  Michal Ludvig  <mludvig@suse.cz>

	* unwind.h (_Unwind_GetGRAddr): New prototype.
	* unwind-dw2.c (_Unwind_GetGRAddr): New function that returns 
	an address where a given register was saved.

--- gcc-3.2.2-orig/gcc/unwind.h	2003-05-02 12:40:08.000000000 +0200
+++ gcc-3.2.2/gcc/unwind.h	2003-05-07 12:43:12.000000000 +0200
@@ -129,6 +129,7 @@
 
 extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int);
 extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
+extern _Unwind_Ptr _Unwind_GetGRAddr (struct _Unwind_Context *, int);
 
 extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
 extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
--- gcc-3.2.2-orig/gcc/unwind-dw2.c	2003-05-02 12:40:08.000000000 +0200
+++ gcc-3.2.2/gcc/unwind-dw2.c	2003-05-07 12:42:50.000000000 +0200
@@ -172,6 +172,15 @@
   * (_Unwind_Word *) context->reg[index] = val;
 }
 
+/* Return the address where the register was saved.  */
+
+inline _Unwind_Ptr
+_Unwind_GetGRAddr (struct _Unwind_Context *context, int index)
+{
+  index = DWARF_REG_TO_UNWIND_COLUMN (index);
+  return context->reg[index];
+}
+
 /* Retrieve the return address for CONTEXT.  */
 
 inline _Unwind_Ptr


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]