2
0
Эх сурвалжийг харах

morphos: implement StackTop to get the stack top from the OS. stack boundaries are detected more precisely now, this fixes stack backtraces with shallow stack, among others

git-svn-id: trunk@36696 -
Károly Balogh 8 жил өмнө
parent
commit
cca38c9f08
1 өөрчлөгдсөн 9 нэмэгдсэн , 1 устгасан
  1. 9 1
      rtl/morphos/system.pp

+ 9 - 1
rtl/morphos/system.pp

@@ -78,9 +78,17 @@ var
 
 implementation
 
+{$define FPC_SYSTEM_HAS_STACKTOP}
+
 {$I system.inc}
 {$I osdebug.inc}
 
+function StackTop: pointer;
+begin
+  StackTop:=PETask(FindTask(nil)^.tc_ETask)^.PPCSPUpper;
+end;
+
+
 {$IFDEF MOSFPC_FILEDEBUG}
 {$WARNING Compiling with file debug enabled!}
 {$ENDIF}
@@ -245,7 +253,7 @@ end;
 begin
   IsConsole := TRUE;
   StackLength := CheckInitialStkLen(InitialStkLen);
-  StackBottom := Sptr - StackLength;
+  StackBottom := StackTop - StackLength;
 { OS specific startup }
   MOS_ambMsg:=nil;
   ASYS_origDir:=0;