[ros-diffs] [tkreuzer] 37329: Fix a bug in DeDecodeU/Sleb128, resulting in wrong allocation unwind codes. Add some debugging stuff.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Nov 13 04:32:10 CET 2008


Author: tkreuzer
Date: Wed Nov 12 21:32:09 2008
New Revision: 37329

URL: http://svn.reactos.org/svn/reactos?rev=37329&view=rev
Log:
Fix a bug in DeDecodeU/Sleb128, resulting in wrong allocation unwind codes. Add some debugging stuff.

Modified:
    branches/ros-amd64-bringup/reactos/tools/rsym/rsym64.c

Modified: branches/ros-amd64-bringup/reactos/tools/rsym/rsym64.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/tools/rsym/rsym64.c?rev=37329&r1=37328&r2=37329&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/tools/rsym/rsym64.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/tools/rsym/rsym64.c [iso-8859-1] Wed Nov 12 21:32:09 2008
@@ -5,6 +5,11 @@
 #include "rsym.h"
 #include "rsym64.h"
 #include "dwarf2.h"
+
+char DoPrint = 0;
+ULONG g_ehframep;
+
+#define DPRINT if(DoPrint) printf
 
 struct {char *name; char regnt;} regs[] =
 { {"rax", REG_RAX}, {"rdx", REG_RDX}, {"rcx", REG_RCX}, {"rbx", REG_RBX},
@@ -35,7 +40,7 @@
 	{
 		current = pc[ulSize];
 		ulSize++;
-		ulResult |= current & 0x7f << ulShift;
+		ulResult |= (current & 0x7f) << ulShift;
 		ulShift += 7;
 	}
 	while (current & 0x80);
@@ -56,7 +61,7 @@
 	{
 		current = pc[ulSize];
 		ulSize++;
-		lResult |= current & 0x7f << ulShift;
+		lResult |= (current & 0x7f) << ulShift;
 		ulShift += 7;
 	}
 	while (current & 0x80);
@@ -214,7 +219,8 @@
     }
     
     State->FramePtrDiff = State->FramePtr - PrevFramePtr;
-//printf("@%p: code=%x, Loc=%lx, offset=%lx, reg=0x%lx:%s\n", pc, code, State->Location, State->Offset, State->Reg, regnames_64[State->Reg]);
+    DPRINT("@%p: code=%x, Loc=%lx, offset=%lx, reg=0x%lx:%s\n", 
+        (void*)((ULONG)pc - g_ehframep), Code, State->Location, State->Offset, State->Reg, regs[State->Reg].name);
     return Length;
 }
 
@@ -427,6 +433,7 @@
 
     /* Get pointer to eh_frame section */
     eh_frame = GetSectionPointer(File, File->eh_frame.idx);
+    g_ehframep = (ULONG)eh_frame;
 
     /* Get sizes */
     CountUnwindData(File);



More information about the Ros-diffs mailing list