Browse Source

Hierarchical profiler now respects the new stackframe format

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6796 8c9fc860-2736-0410-a75d-ab315db34111
skoster 9 years ago
parent
commit
8a8f885d2f
1 changed files with 5 additions and 1 deletions
  1. 5 1
      source/HierarchicalProfiler.Mod

+ 5 - 1
source/HierarchicalProfiler.Mod

@@ -389,7 +389,7 @@ BEGIN
 END AddSample;
 
 PROCEDURE HandleTimer(id: LONGINT; process : Objects.Process;  pc, bp, lowAdr, highAdr : ADDRESS);
-VAR index, depth : LONGINT;
+VAR index, depth : LONGINT; n: ADDRESS;
 BEGIN
 	(* acquire lock that protects currentIndex *)
 	WHILE Machine.AtomicTestSet(locked) DO Machine.SpinHint; (* busy wait *) END;
@@ -411,6 +411,10 @@ BEGIN
 	samples[index][0] := pc;
 	depth := 1;
 	WHILE (bp # 0) & (lowAdr <= bp) & (bp < highAdr) (* Machine.Less(bp, highAdr)*)  & (depth < MaxUnwindingDepth) DO
+		SYSTEM.GET(bp, n);
+		IF ODD(n) THEN
+			INC(bp, SIZEOF(ADDRESS));
+		END;
 		SYSTEM.GET(bp + SIZEOF(ADDRESS), pc);
 		SYSTEM.GET(bp, bp);
 		samples[index][depth] := pc;