This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk 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]

remote dwarf info using libunwind (was: Re: frysk mtg minutes 20060829)


On Sep  1, 2006, Wu Zhou <woodzltc@cn.ibm.com> wrote:

> Elena Zannoni wrote:

>> Libunwind Alex: adding remote features: shouldn't be too hard, but
>> not
>> being able to see how to offer them.  If you are remote, the user is
>> supposed to tell libunwind how to use the information. Possibly export
>> some functions that the users can use as callback.  Cagney says that
>> the problem has been resolved for ia64. Ia64 uses itanium unwind info,
>> which is in the remote process.  Callback to read from remote memory
>> were put in place when JeffJ made gdb use libunwind.  Also need for
>> callbacks to free remote memory that it allocates.  It now just
>> allocates local memory. But this memory will need to be freed
>> explicitly once it is allocated remotely.  Alex says that you need to
>> cache information (didn't catch that, sorry).

> Is there any code available right now? If yes, we would be very happy to have a look at that first.

Here's the patch I've just completed, that works on x86, and fixes a
potential libunwind memory leak while at that.

As it turns out, libunwind already has all that we need, we were just
missing the proper way to use it.  dwarf_find_proc_info() was not it,
since it's specifically designed to operate on the local process.
Part of the libunwind-ptrace interface offers access to everything we
need as far as locating unwind tables et al is concerned, while still
using our own callbacks to interact with the process using ptrace or
whatever.  I'm not sure why we don't just bite the bullet and use all
of the libunwind interface (it looks like it would be much simpler and
would get us what we want), but I figured I wouldn't remove any such
code for now.

Ok to install the patch in bug 3070, attached below for reference?

for frysk-imports/libunwind/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* src/os-linux (tdep_get_elf_image): Define for remote only too.

for  frysk-imports/lib/unwind/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* StackTraceCreator.java (UnwindArgs): New inner class.
	(createStackTrace): Instantiate it.
	(unwind_setup): Take it as argument.
	(unwind_finish): New native method.
	* cni/StackTraceCreator.cxx: Include libunwind-ptrace.h and
	header for new inner class.
	(find_proc_info, put_unwind_info, get_dyn_info_list_addr): Use
	implementation from libunwind-ptrace.
	(access_mem, access_reg, access_fpreg, resume, get_proc_name):
	Adjust.
	(unwind_setup): Set up libunwind-ptrace opaque args and
	UnwindArgs fields that need native finalization.
	(unwind_finish): Finalize them.

for  frysk-imports/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* Makefile.am (GEN_GCJ_LDADD): Link in libunwind-ptrace.a.
	* Makefile.in: Rebuild.

for  frysk-core/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* Makefile.am (GEN_GCJ_LDADD): Link in libunwind-ptrace.a.
	* Makefile.in: Rebuild.

for frysk-core/frysk/rt/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* tests/TestStackBacktrace.java (testBacktrace): Remove
	expected failure marker.

for  frysk-gtk/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* Makefile.am (GEN_GCJ_LDADD): Link in libunwind-ptrace.a.
	* Makefile.in: Rebuild.

for  frysk-gui/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* Makefile.am (GEN_GCJ_LDADD): Link in libunwind-ptrace.a.
	* Makefile.in: Rebuild.

for  frysk-sys/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* Makefile.am (GEN_GCJ_LDADD): Link in libunwind-ptrace.a.
	* Makefile.in: Rebuild.

Index: frysk-imports/lib/unwind/cni/StackTraceCreator.cxx
===================================================================
--- frysk-imports/lib/unwind/cni/StackTraceCreator.cxx.orig	2006-09-04 00:29:47.000000000 -0300
+++ frysk-imports/lib/unwind/cni/StackTraceCreator.cxx	2006-09-04 00:37:46.000000000 -0300
@@ -37,14 +37,18 @@
 // version and license this file solely under the GPL without
 // exception.
 #include <libunwind.h>
+#include <libunwind-ptrace.h>
 #include <endian.h>
 #include <stdio.h>
 #include <gcj/cni.h>
 
 #include "lib/unwind/StackTraceCreator.h"
+#include "lib/unwind/StackTraceCreator$UnwindArgs.h"
 #include "lib/unwind/FrameCursor.h"
 #include "lib/unwind/UnwindCallbacks.h"
 
+typedef lib::unwind::StackTraceCreator$UnwindArgs unwargs;
+
 /***************************
  * CALLBACKS
  * See the UnwindCallbacks
@@ -59,14 +63,8 @@
 int find_proc_info (::unw_addr_space_t as, ::unw_word_t ip, 
 					::unw_proc_info_t *pip, int need_unwind_info, void *arg)
 {
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
-	// delegate to the java interface
-	jboolean retval = cb->findProcInfo ((jlong) pip, (jlong) &as, (jlong) ip, need_unwind_info != 0);
-	
-	if(!retval)
-		return -UNW_ENOINFO;
-	
-	return 0;
+	return _UPT_find_proc_info (as, ip, pip, need_unwind_info,
+				    (void *)((unwargs *)arg)->UPTarg);
 }
 
 /*
@@ -75,8 +73,8 @@ int find_proc_info (::unw_addr_space_t a
 void put_unwind_info (::unw_addr_space_t as, ::unw_proc_info_t *pip,
 						void *arg)
 {
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
-	cb->putUnwindInfo ((jlong) as, (jlong) pip);
+	return _UPT_put_unwind_info (as, pip,
+				     (void *)((unwargs *)arg)->UPTarg);
 }
 
 /*
@@ -85,14 +83,8 @@ void put_unwind_info (::unw_addr_space_t
 int get_dyn_info_list_addr (::unw_addr_space_t as, ::unw_word_t *dilap,
 							void *arg)
 {
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
-	jlong retval = cb->getDynInfoListAddr ((jlong) as);
-	if(retval)
-		*dilap = retval;
-	else
-		dilap = 0;
-	
-	return 0;
+	return _UPT_get_dyn_info_list_addr (as, dilap,
+					    (void *)((unwargs *)arg)->UPTarg);
 }
 
 /*
@@ -101,7 +93,7 @@ int get_dyn_info_list_addr (::unw_addr_s
 int access_mem (::unw_addr_space_t as, ::unw_word_t addr,
 				::unw_word_t *valp, int write, void *arg)
 {
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
+	lib::unwind::UnwindCallbacks *cb = ((unwargs *)arg)->CBarg;
 	
 	// we've separated read and write in the java interface for simplicity
 	if(write == 0){
@@ -122,7 +114,7 @@ int access_reg(::unw_addr_space_t as,
 			::unw_regnum_t regnum, ::unw_word_t *valp,
 			int write, void *arg)
 {
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
+	lib::unwind::UnwindCallbacks *cb = ((unwargs *)arg)->CBarg;
 	
 	// read and write are separated in the java interface
 	if(write == 0){
@@ -143,7 +135,7 @@ int access_fpreg(::unw_addr_space_t as,
 			::unw_regnum_t regnum, ::unw_fpreg_t *fpvalp,
 			int write, void *arg)
 { 
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
+	lib::unwind::UnwindCallbacks *cb = ((unwargs *)arg)->CBarg;
 	
 	if(write == 0){
 		jdouble retval = cb->accessFpreg ((jlong) as, (jlong) regnum);
@@ -162,7 +154,7 @@ int access_fpreg(::unw_addr_space_t as,
 int resume(::unw_addr_space_t as,
 			::unw_cursor_t *cp, void *arg)
 {
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
+	lib::unwind::UnwindCallbacks *cb = ((unwargs *)arg)->CBarg;
 	
 	return (int) cb->resume ((jlong) as, (jlong) cp);
 }
@@ -175,7 +167,7 @@ int get_proc_name(::unw_addr_space_t as,
 			::unw_word_t addr, char *bufp,
 			size_t buf_len, ::unw_word_t *offp, void *arg)
 {
-	lib::unwind::UnwindCallbacks *cb = (lib::unwind::UnwindCallbacks*) arg;
+	lib::unwind::UnwindCallbacks *cb = ((unwargs *)arg)->CBarg;
 	
 	jstring name = cb->getProcName ((jlong) as, (jlong) addr);
 	jlong offset = cb->getProcOffset ((jlong) as, (jlong) addr);
@@ -194,7 +186,7 @@ int get_proc_name(::unw_addr_space_t as,
 }
 
 lib::unwind::FrameCursor*
-lib::unwind::StackTraceCreator::unwind_setup (lib::unwind::UnwindCallbacks *cbs)
+lib::unwind::StackTraceCreator::unwind_setup (unwargs *args)
 {
 	/*
 	 * We don't need to malloc this, since according to the libunwind docs this callback
@@ -205,8 +197,11 @@ lib::unwind::StackTraceCreator::unwind_s
 	
 	// Initialize libunwind
 	::unw_addr_space_t addr_space = ::unw_create_addr_space(&accessors, 0);
+	args->unwas = (jlong)addr_space;
 	::unw_cursor_t cursor;
-	::unw_init_remote(&cursor, addr_space, (void*) cbs);
+	/* Since we're not actually using ptrace, the PID below is unused.  */
+	args->UPTarg = (jlong)_UPT_create (/* PID = */ 0);
+	::unw_init_remote(&cursor, addr_space, args);
 	::unw_set_caching_policy(addr_space, UNW_CACHE_PER_THREAD);
 	
 	// Create the frame objects and return the top (most recent one)
@@ -224,3 +219,12 @@ lib::unwind::StackTraceCreator::unwind_s
 	
 	return base_frame;
 }
+
+void
+lib::unwind::StackTraceCreator::unwind_destroy (unwargs *args)
+{
+	unw_destroy_addr_space ((unw_addr_space_t)args->unwas);
+	args->unwas = 0;
+	_UPT_destroy ((void*)args->UPTarg);
+	args->UPTarg = 0;
+}
Index: frysk-core/Makefile.am
===================================================================
--- frysk-core/Makefile.am.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-core/Makefile.am	2006-09-04 00:31:42.000000000 -0300
@@ -85,7 +85,8 @@ GEN_GCJ_LDADD += ../frysk-imports/elfuti
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libebl/libebl.a
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libelf/libelf.a
 if USE_LIBUNWIND
-GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 endif
 # Stub bfd_getb32 and bfd_getl32 for PPC64.  Unconditionally
 # link -lbfd_get just for simplification.
Index: frysk-core/Makefile.in
===================================================================
--- frysk-core/Makefile.in.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-core/Makefile.in	2006-09-04 00:31:42.000000000 -0300
@@ -168,7 +168,9 @@ pkglibexec_PROGRAMS = frysk/pkglibexecdi
 	frysk/pkglibexecdir/funit-child-alias$(EXEEXT)
 check_PROGRAMS =
 solib_PROGRAMS = libfrysk-core.so$(EXEEXT)
-@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/frysk-use-libunwind.m4 \
@@ -371,7 +373,8 @@ PROGRAMS = $(bin_PROGRAMS) $(libexec_PRO
 	$(pkglibexec_PROGRAMS) $(sbin_PROGRAMS) $(solib_PROGRAMS)
 nodist_TestRunner_OBJECTS = TestRunner.$(OBJEXT)
 TestRunner_OBJECTS = $(nodist_TestRunner_OBJECTS)
-@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@	../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 am__DEPENDENCIES_2 = libfrysk-core.a ../frysk-sys/libfrysk-sys.a \
 	../frysk-imports/libfrysk-imports.a \
 	../frysk-imports/libfrysk-jline.a \
Index: frysk-core/frysk/rt/tests/TestStackBacktrace.java
===================================================================
--- frysk-core/frysk/rt/tests/TestStackBacktrace.java.orig	2006-09-04 00:29:47.000000000 -0300
+++ frysk-core/frysk/rt/tests/TestStackBacktrace.java	2006-09-04 00:31:53.000000000 -0300
@@ -60,9 +60,6 @@ public class TestStackBacktrace
 
   public void testBacktrace () throws TaskException
   {
-     if (brokenXXX(2936))
-      return;
-    
     class TaskCreatedObserver extends TaskObserverBase
         implements TaskObserver.Attached
     {
Index: frysk-gtk/Makefile.am
===================================================================
--- frysk-gtk/Makefile.am.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-gtk/Makefile.am	2006-09-04 00:31:42.000000000 -0300
@@ -59,7 +59,8 @@ GEN_GCJ_LDADD += ../frysk-imports/elfuti
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libebl/libebl.a
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libelf/libelf.a
 if USE_LIBUNWIND
-GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 endif
 # Stub bfd_getb32 and bfd_getl32 for PPC64.  Unconditionally
 # link -lbfd_get just for simplification.
Index: frysk-gtk/Makefile.in
===================================================================
--- frysk-gtk/Makefile.in.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-gtk/Makefile.in	2006-09-04 00:31:42.000000000 -0300
@@ -135,7 +135,9 @@ pkglibexec_PROGRAMS =
 check_PROGRAMS =
 solib_PROGRAMS = libfrysk-ftk.so$(EXEEXT) libfrysk-gtk.so$(EXEEXT) \
 	EggTrayIcon/libEggTrayIcon.so$(EXEEXT)
-@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/frysk-use-libunwind.m4 \
@@ -197,7 +199,8 @@ am__DEPENDENCIES_1 =
 EggTrayIcon_libEggTrayIcon_so_DEPENDENCIES = $(am__DEPENDENCIES_1)
 nodist_TestRunner_OBJECTS = TestRunner.$(OBJEXT)
 TestRunner_OBJECTS = $(nodist_TestRunner_OBJECTS)
-@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_2 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_2 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@	../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 am__DEPENDENCIES_3 = libfrysk-gtk.a \
 	../frysk-imports/libfrysk-imports.a \
 	../frysk-imports/libfrysk-junit.a \
Index: frysk-gui/Makefile.am
===================================================================
--- frysk-gui/Makefile.am.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-gui/Makefile.am	2006-09-04 00:31:42.000000000 -0300
@@ -75,7 +75,8 @@ GEN_GCJ_LDADD += ../frysk-imports/elfuti
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libebl/libebl.a
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libelf/libelf.a
 if USE_LIBUNWIND
-GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 endif
 GEN_GCJ_LDADD += ../frysk-gtk/libfrysk-ftk.a
 GEN_GCJ_LDADD += -L../frysk-gtk/EggTrayIcon
Index: frysk-gui/Makefile.in
===================================================================
--- frysk-gui/Makefile.in.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-gui/Makefile.in	2006-09-04 00:31:42.000000000 -0300
@@ -136,7 +136,9 @@ libexec_PROGRAMS =
 pkglibexec_PROGRAMS =
 check_PROGRAMS =
 solib_PROGRAMS = libfrysk-gui.so$(EXEEXT)
-@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/frysk-use-libunwind.m4 \
@@ -369,7 +371,8 @@ PROGRAMS = $(bin_PROGRAMS) $(libexec_PRO
 	$(pkglibexec_PROGRAMS) $(sbin_PROGRAMS) $(solib_PROGRAMS)
 nodist_TestRunner_OBJECTS = TestRunner.$(OBJEXT)
 TestRunner_OBJECTS = $(nodist_TestRunner_OBJECTS)
-@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@	../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 am__DEPENDENCIES_2 =
 am__DEPENDENCIES_3 = libfrysk-gui.a ../frysk-gtk/libfrysk-gtk.a \
 	../frysk-core/libfrysk-core.a ../frysk-sys/libfrysk-sys.a \
Index: frysk-imports/Makefile.am
===================================================================
--- frysk-imports/Makefile.am.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-imports/Makefile.am	2006-09-04 00:31:42.000000000 -0300
@@ -49,7 +49,7 @@ CHECK_SUBDIRS = \
 	elfutils
 
 SUBDIRS = $(CHECK_SUBDIRS)
-	
+
 # Add in libunwind only for certain arches
 if USE_LIBUNWIND
 SUBDIRS += libunwind
@@ -82,7 +82,8 @@ GEN_GCJ_LDADD += ./elfutils/libelf/libel
 
 # Add in libunwind only for certain arches
 if USE_LIBUNWIND
-GEN_GCJ_LDADD += ./libunwind/src/libunwind-$(libunwind_cpu).a 
+GEN_GCJ_LDADD += ./libunwind/src/libunwind-ptrace.a \
+		 ./libunwind/src/libunwind-$(libunwind_cpu).a
 endif
 
 # Stub bfd_getb32 and bfd_getl32 for PPC64.  Unconditionally 
Index: frysk-imports/Makefile.in
===================================================================
--- frysk-imports/Makefile.in.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-imports/Makefile.in	2006-09-04 00:31:42.000000000 -0300
@@ -147,7 +147,9 @@ solib_PROGRAMS = libfrysk-junit.so$(EXEE
 @USE_LIBUNWIND_TRUE@am__append_1 = libunwind
 
 # Add in libunwind only for certain arches
-@USE_LIBUNWIND_TRUE@am__append_2 = ./libunwind/src/libunwind-$(libunwind_cpu).a 
+@USE_LIBUNWIND_TRUE@am__append_2 = ./libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@		 ./libunwind/src/libunwind-$(libunwind_cpu).a
+
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/ac_find_file.m4 \
@@ -315,7 +317,9 @@ PROGRAMS = $(bin_PROGRAMS) $(libexec_PRO
 	$(pkglibexec_PROGRAMS) $(sbin_PROGRAMS) $(solib_PROGRAMS)
 nodist_TestRunner_OBJECTS = TestRunner.$(OBJEXT)
 TestRunner_OBJECTS = $(nodist_TestRunner_OBJECTS)
-@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 = ./libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 =  \
+@USE_LIBUNWIND_TRUE@	./libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@	./libunwind/src/libunwind-$(libunwind_cpu).a
 am__DEPENDENCIES_2 = libfrysk-imports.a libfrysk-jargs.a \
 	libfrysk-junit.a ./elfutils/libdwfl/libdwfl.a \
 	./elfutils/libdw/libdw.a ./elfutils/libebl/libebl.a \
Index: frysk-imports/lib/unwind/StackTraceCreator.java
===================================================================
--- frysk-imports/lib/unwind/StackTraceCreator.java.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-imports/lib/unwind/StackTraceCreator.java	2006-09-04 00:37:01.000000000 -0300
@@ -51,8 +51,28 @@ public class StackTraceCreator
    */
   public static FrameCursor createStackTrace (UnwindCallbacks callbacks)
   {
-    return unwind_setup(callbacks);
+    return unwind_setup(new UnwindArgs (callbacks));
   }
 
-  private static native FrameCursor unwind_setup (UnwindCallbacks callbacks);
+  private static native FrameCursor unwind_setup (UnwindArgs args);
+
+  private static native void unwind_finish (UnwindArgs args);
+
+  private static class UnwindArgs
+  {
+    public UnwindCallbacks CBarg;
+    public long UPTarg;
+    public long unwas;
+
+    public UnwindArgs (UnwindCallbacks CBarg)
+    {
+      this.CBarg = CBarg;
+      this.UPTarg = 0;
+      this.unwas = 0;
+    }
+
+    public void finalize () {
+      unwind_finish (this);
+    }
+  }
 }
Index: frysk-imports/libunwind/src/os-linux.c
===================================================================
--- frysk-imports/libunwind/src/os-linux.c.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-imports/libunwind/src/os-linux.c	2006-09-04 00:31:42.000000000 -0300
@@ -23,8 +23,6 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER L
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
 
-#ifndef UNW_REMOTE_ONLY
-
 #include <limits.h>
 #include <stdio.h>
 
@@ -54,5 +52,3 @@ tdep_get_elf_image (struct elf_image *ei
 
   return elf_map_image (ei, path);
 }
-
-#endif /* UNW_REMOTE_ONLY */
Index: frysk-sys/Makefile.am
===================================================================
--- frysk-sys/Makefile.am.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-sys/Makefile.am	2006-09-04 00:31:42.000000000 -0300
@@ -57,7 +57,8 @@ GEN_GCJ_LDADD += ../frysk-imports/elfuti
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libebl/libebl.a
 GEN_GCJ_LDADD += ../frysk-imports/elfutils/libelf/libelf.a
 if USE_LIBUNWIND
-GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+GEN_GCJ_LDADD += ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 endif
 # Stub bfd_getb32 and bfd_getl32 for PPC64.  Unconditionally
 # link -lbfd_get just for simplification.
Index: frysk-sys/Makefile.in
===================================================================
--- frysk-sys/Makefile.in.orig	2006-09-04 00:29:46.000000000 -0300
+++ frysk-sys/Makefile.in	2006-09-04 00:31:42.000000000 -0300
@@ -133,7 +133,9 @@ libexec_PROGRAMS =
 pkglibexec_PROGRAMS =
 check_PROGRAMS =
 solib_PROGRAMS = libfrysk-sys.so$(EXEEXT)
-@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__append_1 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@		 ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/frysk-use-libunwind.m4 \
@@ -216,7 +218,8 @@ PROGRAMS = $(bin_PROGRAMS) $(libexec_PRO
 	$(pkglibexec_PROGRAMS) $(sbin_PROGRAMS) $(solib_PROGRAMS)
 nodist_TestRunner_OBJECTS = TestRunner.$(OBJEXT)
 TestRunner_OBJECTS = $(nodist_TestRunner_OBJECTS)
-@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 = ../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
+@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_1 = ../frysk-imports/libunwind/src/libunwind-ptrace.a \
+@USE_LIBUNWIND_TRUE@	../frysk-imports/libunwind/src/libunwind-$(libunwind_cpu).a
 am__DEPENDENCIES_2 = libfrysk-sys.a \
 	../frysk-imports/libfrysk-imports.a \
 	../frysk-imports/libfrysk-junit.a \
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Secretary for FSF Latin America        http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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