summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc/gcc-4.3.1/debian/libjava-stacktrace.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gcc/gcc-4.3.1/debian/libjava-stacktrace.dpatch')
-rw-r--r--meta/packages/gcc/gcc-4.3.1/debian/libjava-stacktrace.dpatch70
1 files changed, 70 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.3.1/debian/libjava-stacktrace.dpatch b/meta/packages/gcc/gcc-4.3.1/debian/libjava-stacktrace.dpatch
new file mode 100644
index 0000000000..9ace9dfb28
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.1/debian/libjava-stacktrace.dpatch
@@ -0,0 +1,70 @@
1#! /bin/sh -e
2
3# DP: libgcj: Lookup source file name and line number in separated
4# DP: debug files found in /usr/lib/debug
5
6dir=
7if [ $# -eq 3 -a "$2" = '-d' ]; then
8 pdir="-d $3"
9 dir="$3/"
10elif [ $# -ne 1 ]; then
11 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
12 exit 1
13fi
14case "$1" in
15 -patch)
16 patch $pdir -f --no-backup-if-mismatch -p0 < $0
17 ;;
18 -unpatch)
19 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
20 ;;
21 *)
22 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
23 exit 1
24esac
25exit 0
26
27
28--- libjava/stacktrace.cc.orig 2006-06-16 13:54:07.078577632 +0200
29+++ libjava/stacktrace.cc 2006-06-16 13:56:08.032189888 +0200
30@@ -20,6 +20,11 @@
31 #endif
32
33 #include <stdio.h>
34+#include <stdlib.h>
35+#include <string.h>
36+#ifdef HAVE_UNISTD_H
37+#include <unistd.h>
38+#endif
39
40 #include <java/lang/Class.h>
41 #include <java/lang/Long.h>
42@@ -222,6 +227,28 @@
43 finder->lookup (binaryName, (jlong) offset);
44 *sourceFileName = finder->getSourceFile();
45 *lineNum = finder->getLineNum();
46+ if (*lineNum == -1 && info.file_name[0] == '/')
47+ {
48+ const char *debugPrefix = "/usr/lib/debug";
49+ char *debugPath = (char *) malloc (strlen(debugPrefix)
50+ + strlen(info.file_name)
51+ + 2);
52+
53+ if (debugPath)
54+ {
55+ strcpy (debugPath, debugPrefix);
56+ strcat (debugPath, info.file_name);
57+ //printf ("%s: 0x%x\n", debugPath, offset);
58+ if (!access (debugPath, R_OK))
59+ {
60+ binaryName = JvNewStringUTF (debugPath);
61+ finder->lookup (binaryName, (jlong) offset);
62+ *sourceFileName = finder->getSourceFile();
63+ *lineNum = finder->getLineNum();
64+ }
65+ free (debugPath);
66+ }
67+ }
68 if (*lineNum == -1 && NameFinder::showRaw())
69 {
70 gnu::gcj::runtime::StringBuffer *t =