~ubuntu-branches/ubuntu/raring/gcc-4.7/raring

« back to all changes in this revision

Viewing changes to debian/patches/libjava-stacktrace.diff

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-12-17 23:19:46 UTC
  • Revision ID: package-import@ubuntu.com-20111217231946-n668coanjbjgqxq7
Tags: 4.7-20111217-1
* GCC-4.7 snapshot build.
  - Including the GFDL documentation; will stay in experimental
    until the 4.7.0 release sometime next year.
* Update patches for the trunk.
* Update symbols files.
* Build libitm packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: libgcj: Lookup source file name and line number in separated
 
2
# DP: debug files found in /usr/lib/debug
 
3
 
 
4
---
 
5
 libjava/stacktrace.cc |   27 +++++++++++++++++++++++++++
 
6
 1 files changed, 27 insertions(+), 0 deletions(-)
 
7
 
 
8
--- a/src/libjava/stacktrace.cc
 
9
+++ b/src/libjava/stacktrace.cc
 
10
@@ -17,6 +17,11 @@
 
11
 #include <java-stack.h>
 
12
 
 
13
 #include <stdio.h>
 
14
+#include <stdlib.h>
 
15
+#include <string.h>
 
16
+#ifdef HAVE_UNISTD_H
 
17
+#include <unistd.h>
 
18
+#endif
 
19
 
 
20
 #include <java/lang/Boolean.h>
 
21
 #include <java/lang/Class.h>
 
22
@@ -260,6 +265,28 @@
 
23
       finder->lookup (binaryName, (jlong) offset);
 
24
       *sourceFileName = finder->getSourceFile();
 
25
       *lineNum = finder->getLineNum();
 
26
+      if (*lineNum == -1 && info.file_name[0] == '/')
 
27
+       {
 
28
+         const char *debugPrefix = "/usr/lib/debug";
 
29
+         char *debugPath = (char *) malloc (strlen(debugPrefix)
 
30
+                                            + strlen(info.file_name)
 
31
+                                            + 2);
 
32
+
 
33
+         if (debugPath)
 
34
+           {
 
35
+             strcpy (debugPath, debugPrefix);
 
36
+             strcat (debugPath, info.file_name);
 
37
+             //printf ("%s: 0x%x\n", debugPath, offset);
 
38
+             if (!access (debugPath, R_OK))
 
39
+               {
 
40
+                 binaryName = JvNewStringUTF (debugPath);
 
41
+                 finder->lookup (binaryName, (jlong) offset);
 
42
+                 *sourceFileName = finder->getSourceFile();
 
43
+                 *lineNum = finder->getLineNum();
 
44
+               }
 
45
+             free (debugPath);
 
46
+           }
 
47
+       }
 
48
       if (*lineNum == -1 && NameFinder::showRaw())
 
49
         {
 
50
           gnu::gcj::runtime::StringBuffer *t =