* sysdep/descriptor-n.h: New file.
* sysdep/descriptor-y.h: New file.
* sysdep/powerpc/descriptor.h: New file.
* configure.host: Set $descriptor_h appropriate for the host.
* configure.ac: Link it.
* configure: Regenerate.
* stacktrace.cc: Include sysdep/descriptor.h.
(_Jv_StackTrace::UpdateNCodeMap): Use UNWRAP_FUNCTION_DESCRIPTOR.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100173
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-05-25 Richard Henderson <rth@redhat.com>
+
+ PR libgcj/21692
+ * sysdep/descriptor-n.h: New file.
+ * sysdep/descriptor-y.h: New file.
+ * sysdep/powerpc/descriptor.h: New file.
+ * configure.host: Set $descriptor_h appropriate for the host.
+ * configure.ac: Link it.
+ * configure: Regenerate.
+ * stacktrace.cc: Include sysdep/descriptor.h.
+ (_Jv_StackTrace::UpdateNCodeMap): Use UNWRAP_FUNCTION_DESCRIPTOR.
+
2005-05-25 Chris Burdess <dog@gnu.org>
* gnu/xml/dom/ls/SAXEventSink.java: Ignore XML entities in start/
ac_config_links="$ac_config_links sysdep/backtrace.h:$fallback_backtrace_h"
+ ac_config_links="$ac_config_links sysdep/descriptor.h:$descriptor_h"
+
HASH_SYNC_SPEC=
# Hash synchronization is only useful with posix threads right now.
"include/java-threads.h" ) CONFIG_LINKS="$CONFIG_LINKS include/java-threads.h:include/$THREADH" ;;
"sysdep/locks.h" ) CONFIG_LINKS="$CONFIG_LINKS sysdep/locks.h:sysdep/$sysdeps_dir/locks.h" ;;
"sysdep/backtrace.h" ) CONFIG_LINKS="$CONFIG_LINKS sysdep/backtrace.h:$fallback_backtrace_h" ;;
+ "sysdep/descriptor.h" ) CONFIG_LINKS="$CONFIG_LINKS sysdep/descriptor.h:$descriptor_h" ;;
"include/java-signal.h" ) CONFIG_LINKS="$CONFIG_LINKS include/java-signal.h:$SIGNAL_HANDLER" ;;
"include/java-signal-aux.h" ) CONFIG_LINKS="$CONFIG_LINKS include/java-signal-aux.h:$SIGNAL_HANDLER_AUX" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
if test -d sysdep; then true; else mkdir sysdep; fi
AC_CONFIG_LINKS(sysdep/locks.h:sysdep/$sysdeps_dir/locks.h)
AC_CONFIG_LINKS(sysdep/backtrace.h:$fallback_backtrace_h)
+AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
HASH_SYNC_SPEC=
# Hash synchronization is only useful with posix threads right now.
# (i.e it is broken).
# fallback_backtrace_h Header to use for fallback backtrace implementation
# (only for targets that don't support DWARF2 unwind)
+# descriptor_h Header to use for looking past function descriptors
libgcj_flags=
libgcj_cflags=
;;
esac
+case "${host}" in
+ ia64-* | hppa*-*)
+ descriptor_h=sysdep/descriptor-y.h
+ ;;
+
+ rs6000-* | powerpc*-*)
+ descriptor_h=sysdep/powerpc/descriptor.h
+ ;;
+
+ *)
+ descriptor_h=sysdep/descriptor-n.h
+ ;;
+esac
libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
#include <gnu/gcj/runtime/NameFinder.h>
#include <sysdep/backtrace.h>
+#include <sysdep/descriptor.h>
using namespace java::lang;
using namespace java::lang::reflect;
for (int i=0; i < klass->method_count; i++)
{
_Jv_Method *method = &klass->methods[i];
+ void *ncode = method->ncode;
// Add non-abstract methods to ncodeMap.
- if (method->ncode)
+ if (ncode)
{
- //printf("map->put 0x%x / %s.%s\n", method->ncode, klass->name->data,
- // method->name->data);
- ncodeMap->put ((java::lang::Object *) method->ncode, klass);
+ ncode = UNWRAP_FUNCTION_DESCRIPTOR (ncode);
+ ncodeMap->put ((java::lang::Object *)ncode, klass);
}
}
}
--- /dev/null
+// Given a function pointer, return the code address.
+
+#define UNWRAP_FUNCTION_DESCRIPTOR(X) (X)
--- /dev/null
+// Given a function pointer, return the code address.
+
+// The function descriptor is actually multiple words,
+// but we don't care about anything except the first.
+#define UNWRAP_FUNCTION_DESCRIPTOR(X) (*(void **)(X))
--- /dev/null
+// Given a function pointer, return the code address.
+
+#ifdef _CALL_AIX
+// The function descriptor is actually multiple words,
+// but we don't care about anything except the first.
+# define UNWRAP_FUNCTION_DESCRIPTOR(X) (*(void **)(X))
+#else
+# define UNWRAP_FUNCTION_DESCRIPTOR(X) (X)
+#endif