dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog engine/debugger.c


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnet ChangeLog engine/debugger.c
Date: Fri, 09 Feb 2007 18:39:50 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnet
Changes by:     Radek Polak <radekp>    07/02/09 18:39:50

Modified files:
        .              : ChangeLog 
        engine         : debugger.c 

Log message:
        make the show_dasm command work with jit coder

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3411&r2=1.3412
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/debugger.c?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3411
retrieving revision 1.3412
diff -u -b -r1.3411 -r1.3412
--- ChangeLog   6 Feb 2007 21:52:34 -0000       1.3411
+++ ChangeLog   9 Feb 2007 18:39:50 -0000       1.3412
@@ -1,3 +1,7 @@
+2007-02-09  Radek Polak  <address@hidden>
+
+       * pnet/engine/debugger.c: Make show_dasm command work with jit coder.
+
 2007-02-06  Klaus Treichel  <address@hidden>
 
        * libffi/configure.ac, libffi/configure: Remuve the testsuite from the

Index: engine/debugger.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/debugger.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- engine/debugger.c   23 Jan 2007 19:49:02 -0000      1.10
+++ engine/debugger.c   9 Feb 2007 18:39:50 -0000       1.11
@@ -486,11 +486,16 @@
  * Dump position of execution.
  */
 void DumpExecPosition(FILE *stream, ILMethod *method,
-                                                       ILUInt32 offset, const 
char *sourceFile,
+                                                       ILUInt32 offset, void 
*pc, const char *sourceFile,
                                                        ILUInt32 line, ILUInt32 
col, int indent)
 {
        Indent(stream, indent);
-       fprintf(stream, "<ExecPosition Offset=\"%d\">\n", offset);
+       fprintf(stream, "<ExecPosition Offset=\"%d\"", offset);
+       if(pc != 0)
+       {
+               fprintf(stream, " PC=\"%p\"", pc);
+       }
+       fputs(">\n", stream);
        DumpMethod(stream, method, indent + 2);
        DumpLocation(stream, sourceFile, line, col, indent + 2);
        Indent(stream, indent);
@@ -506,6 +511,7 @@
        fprintf(stream, "<Breakpoint Id=\"%d\" >\n", breakpoint->id);
        DumpExecPosition(stream, breakpoint->method,
                                                        breakpoint->offset,
+                                                       0,
                                                        breakpoint->sourceFile,
                                                        breakpoint->line,
                                                        breakpoint->col, indent 
+ 2);
@@ -553,7 +559,7 @@
 
        /* Dump the frame */
        DumpExecPosition(stream, frame->method,
-                                               offset, sourceFile,
+                                               offset, 0, sourceFile,
                                                line, col, indent);
 }
 #endif // IL_USE_CVM
@@ -1167,9 +1173,11 @@
        UpdateLocation(debugger);
        DumpExecPosition(stream, debugger->dbthread->method,
                                                                
debugger->dbthread->offset,
+                                                               0,
                                                                
debugger->dbthread->sourceFile,
                                                                
debugger->dbthread->line,
-                                                               
debugger->dbthread->col, 0);
+                                                               
debugger->dbthread->col,
+                                                               0);
 }
 
 /*
@@ -1230,6 +1238,7 @@
        ILUInt32 line;
        ILUInt32 col;
        const char *sourceFile;
+       void *pc;
 
        /* Get jit stack trace */
        stackTrace = debugger->dbthread->jitStackTrace;
@@ -1263,10 +1272,11 @@
 
                                /* Read current position from debug info */
                                sourceFile = GetLocation(method, offset, &line, 
&col);
+                               pc = jit_stack_trace_get_pc(stackTrace, 
current);
 
                                /* Dump the frame */
-                               DumpExecPosition(stream, method, offset, 
sourceFile,
-                                                                               
                                                line, col, 4);
+                               DumpExecPosition(stream, method, offset, pc,
+                                                                               
                sourceFile, line, col, 4);
                        }
                }
        }
@@ -1712,6 +1722,12 @@
  */
 void ShowDasm(ILDebugger *debugger, FILE *stream)
 {
+       char *str;
+       long pos;
+
+       /* Remeber current position before dump */
+       pos = ftell(stream);
+
 #ifdef IL_USE_JIT
        ILJitFunction func = 
ILJitFunctionFromILMethod(debugger->dbthread->method);
        jit_dump_function(stream, func, 
ILMethod_Name(debugger->dbthread->method));
@@ -1720,8 +1736,35 @@
        _ILDumpCVMInsn(stream, debugger->dbthread->method,
                                                                                
debugger->dbthread->execThread->pc);
 #endif
+
+       /* Read stream to memory so that we can dump with xml quoting */
+       str = ReadStream(stream);
+
+       /* Restore position */
+       fseek(stream, pos, SEEK_SET);
+
+       if(!str)
+       {
+               DumpError("Out of memory", stream);
+               return;
+       }
+
+       fputs("<Dasm>\n", stream);
+       fputs("<Text>\n", stream);
+       DumpString(str + pos, stream);
+       fputs("</Text>\n", stream);
+       fputs("</Dasm>\n", stream);
+
+       ILFree(str);
 }
 
+/* TODO we need to link against ildasm
+
+#include "../ildasm/ildasm_utils.c"
+#include "../ildasm/ildasm_attrs.c"
+#include "../ildasm/ildasm_method.c"
+*/
+
 /*
  * show_ildasm command.
  */
@@ -1731,7 +1774,8 @@
        ILImage *image;
 
        image = ILClassToImage(ILMethod_Owner(debugger->dbthread->method));
-       ILDAsmDumpMethod(image, stream, debugger->dbthread->method, 0, 0); */
+       ILDAsmDumpMethod(image, stream, debugger->dbthread->method, 0, 0);
+       */
 }
 
 /*




reply via email to

[Prev in Thread] Current Thread [Next in Thread]