瀏覽代碼

improved disassembly (course syscon)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7383 8c9fc860-2736-0410-a75d-ab315db34111
felixf 7 年之前
父節點
當前提交
a3e5eaf3d8
共有 3 個文件被更改,包括 10 次插入4 次删除
  1. 8 2
      source/FoxDisassembler.Mod
  2. 1 1
      source/StdIOShell.Mod
  3. 1 1
      source/Win32.Traps.Mod

+ 8 - 2
source/FoxDisassembler.Mod

@@ -3,7 +3,7 @@ MODULE FoxDisassembler; (** AUTHOR ""; PURPOSE ""; *)
 IMPORT Streams, ObjectFile, Scanner := FoxScanner, Basic := FoxBasic, BitSets, D := Debugging, Files, Commands;
 IMPORT Streams, ObjectFile, Scanner := FoxScanner, Basic := FoxBasic, BitSets, D := Debugging, Files, Commands;
 
 
 
 
-CONST Trace = TRUE;
+CONST Trace = FALSE;
 TYPE
 TYPE
 	Block*= POINTER TO RECORD (ObjectFile.Section)
 	Block*= POINTER TO RECORD (ObjectFile.Section)
 		to-: LONGINT;
 		to-: LONGINT;
@@ -54,12 +54,18 @@ TYPE
 			WHILE (b # NIL) & ((adr < b.alignment-offset) OR (adr > b.to - offset) OR (ObjectFile.IsCode(b.type)#isCode)) DO
 			WHILE (b # NIL) & ((adr < b.alignment-offset) OR (adr > b.to - offset) OR (ObjectFile.IsCode(b.type)#isCode)) DO
 				b := b.next;
 				b := b.next;
 			END;
 			END;
+			IF b = NIL THEN 
+				(* try to find any matching section *)
+				WHILE (b # NIL) & ((adr < b.alignment-offset) OR (adr > b.to - offset))  DO
+					b := b.next;
+				END;
+			END;
 			IF (b # NIL) & (b # block) THEN
 			IF (b # NIL) & (b # block) THEN
 				Basic.SegmentedNameToString(b.identifier.name, name);
 				Basic.SegmentedNameToString(b.identifier.name, name);
 				w.String(" [");
 				w.String(" [");
 				w.String(name);
 				w.String(name);
 				IF adr # b.alignment THEN
 				IF adr # b.alignment THEN
-					w.String("+"); w.Int(adr-b.alignment,1)
+					w.String("+"); w.Int(adr-b.alignment+offset,1)
 				END;
 				END;
 				w.String("]");
 				w.String("]");
 			END;
 			END;

+ 1 - 1
source/StdIOShell.Mod

@@ -70,7 +70,7 @@ Command line shell: (Windows):
 StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Traps RelativeFileSystem WMDefaultFont SystemTools Shell StdIOShell ~
 StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Traps RelativeFileSystem WMDefaultFont SystemTools Shell StdIOShell ~
 
 
 Command line shell including compiler (and linker)
 Command line shell including compiler (and linker)
-StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Traps RelativeFileSystem WMDefaultFont SystemTools StdIOShell 
+StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Traps RelativeFileSystem SystemTools FSTools StdIOShell 
 Shell StaticLinker Compiler FoxOberonFrontend FoxARMBackend FoxAMDBackend
 Shell StaticLinker Compiler FoxOberonFrontend FoxARMBackend FoxAMDBackend
 ~
 ~
 
 

+ 1 - 1
source/Win32.Traps.Mod

@@ -405,7 +405,7 @@ VAR
 		END;
 		END;
 
 
 		IF TestTrap & (s[0] = "2") THEN HALT( 99 ) END;
 		IF TestTrap & (s[0] = "2") THEN HALT( 99 ) END;
-		Objects.InstallExceptionHandler( Exception );  KernelLog.String( "Traps: TrapHandler installed" );  KernelLog.Ln;
+		Objects.InstallExceptionHandler( Exception );  
 	END Init;
 	END Init;
 
 
 	PROCEDURE Install*; (* for loading this module *)
 	PROCEDURE Install*; (* for loading this module *)