[ros-diffs] [cwittich] 37960: show file/line information for usermode crashes

cwittich at svn.reactos.org cwittich at svn.reactos.org
Tue Dec 9 13:44:27 CET 2008


Author: cwittich
Date: Tue Dec  9 06:44:27 2008
New Revision: 37960

URL: http://svn.reactos.org/svn/reactos?rev=37960&view=rev
Log:
show file/line information for usermode crashes

Modified:
    trunk/tools/sysreg2/makefile
    trunk/tools/sysreg2/raddr2line.c

Modified: trunk/tools/sysreg2/makefile
URL: http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/makefile?rev=37960&r1=37959&r2=37960&view=diff
==============================================================================
--- trunk/tools/sysreg2/makefile [iso-8859-1] (original)
+++ trunk/tools/sysreg2/makefile [iso-8859-1] Tue Dec  9 06:44:27 2008
@@ -5,8 +5,8 @@
 all: $(TARGET)
 
 CC=gcc
-CFLAGS := -O2 -std=c99 -D_GNU_SOURCE
-LFLAGS := -s -L/usr/lib64
+CFLAGS := -g -O0 -std=c99 -D_GNU_SOURCE
+LFLAGS := -L/usr/lib64
 LIBS := -lgcc -lm -lvirt -ltasn1 -lz -lxml2 -lgnutls
 INC := -I/usr/include/libvirt/ -I/usr/include/libxml2/
 

Modified: trunk/tools/sysreg2/raddr2line.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/raddr2line.c?rev=37960&r1=37959&r2=37960&view=diff
==============================================================================
--- trunk/tools/sysreg2/raddr2line.c [iso-8859-1] (original)
+++ trunk/tools/sysreg2/raddr2line.c [iso-8859-1] Tue Dec  9 06:44:27 2008
@@ -33,6 +33,7 @@
 
 bool ResolveAddressFromFile(char* Buffer, int BuffSize, char* Data)
 {
+    int Resolved = 0;
     char* sep;
     char* sep2;
     char Module[32];
@@ -50,35 +51,59 @@
             Module[(int)(sep-Data)-2] = '\0';
             sep2 = strchr(Data, '>');
             strncpy(Addr, Data + (sep - Data + 1), (int) (sep2 - sep) -1);
-            Addr[(int)(sep2- sep)-1] = '\0';   
+            Addr[(int)(sep2-sep)-1] = '\0'; 
+            Resolved = 1;
+        }
+    }
 
-            if (GetPackagePath(PkgData, sizeof(PkgData), Module))
+    sep = strchr(Data, '+');
+    if ((sep) && strchr(Data, ':'))
+    {
+        sep2 = strchr(Data + (sep - Data), ' ');
+        strncpy(Addr, Data + (sep - Data + 1), (int) (sep2 - sep) - 1);
+        Addr[(int)(sep2-sep) - 1] = '\0';
+        sep = strrchr(Data, '\\');
+        strcpy(Module, sep + 1);
+        Module[strlen(Module) - 2] = '\0';
+        Resolved = 2;
+    }
+
+    if (Resolved > 0)
+    {
+        if (GetPackagePath(PkgData, sizeof(PkgData), Module))
+        {
+            const char* outdir = getenv("ROS_OUTPUT");
+            char* ptr;
+            if (!outdir)
+                outdir = emptystr;
+            sprintf(Command, "%s/tools/raddr2line %s/%s %s 2>&1", 
+                    outdir, outdir, PkgData, Addr);
+            FILE* p = popen(Command, "r");
+            char buf[100] = {'\0'};
+            while(feof(p)==0)
             {
-                const char* outdir = getenv("ROS_OUTPUT");
-                char* ptr;
-                if (!outdir)
-                    outdir = emptystr;
-                sprintf(Command, "%s/tools/raddr2line %s/%s %s 2>&1", 
-                        outdir, outdir, PkgData, Addr);
-                FILE* p = popen(Command, "r");
-                char buf[100] = {'\0'};
-                while(feof(p)==0)
+                fgets(buf,100,p);
+                if (strstr(buf, "error"))
+                    strcpy(buf, "(no debug info)");
+                ptr = strchr(buf, '\n');
+                if (ptr)
+                    *ptr = '\0'; 
+                ptr = strchr(Data, '>');
+                if (ptr)
+                    *ptr = '\0';
+                if (Resolved == 2)
                 {
-                    fgets(buf,100,p);
-                    if (strstr(buf, "error"))
-                        strcpy(buf, "(no debug info)");
-                    ptr = strchr(buf, '\n');
-                    if (ptr)
-                        *ptr = '\0'; 
-                    ptr = strchr(Data, '>');
+                    ptr = strchr(Data, '\n');
                     if (ptr)
                         *ptr = '\0';
-                    strcpy(Buffer, Data);
-                    strcat(Buffer, " "); 
-                    strcat(Buffer, buf);
-                    strcat(Buffer, ">\n");
-                    return true;
                 }
+                strcpy(Buffer, Data);
+                strcat(Buffer, " ");
+                if (Resolved == 2)
+                    strcat(Buffer, "<");
+                strcat(Buffer, buf);
+                strcat(Buffer, ">\n");
+                return true;     
             }
         }
     }



More information about the Ros-diffs mailing list