소스 검색

+ return a small, fake backtrace for WebAssembly, so that in case of a runtime
error, the message 'Runtime error XXX at $EEEEEEEE' appears.

Nikolay Nikolov 3 년 전
부모
커밋
d9eb8d75b9
1개의 변경된 파일17개의 추가작업 그리고 3개의 파일을 삭제
  1. 17 3
      rtl/wasm32/wasm32.inc

+ 17 - 3
rtl/wasm32/wasm32.inc

@@ -36,10 +36,24 @@ procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];
   end;
 
 
-{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
-function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;
+{$define FPC_SYSTEM_HAS_GET_PC_ADDR}
+Function Get_pc_addr : CodePointer;
   begin
-    result:=nil;
+    { dummy, produces a small, fake backtrace, otherwise programs terminate
+      with no output at all, in case of a runtime error }
+    result:=CodePointer($eeeeeeef);
+  end;
+
+
+{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
+function get_caller_addr(framebp:pointer;addr:codepointer=nil):pointer;
+  begin
+    { dummy, produces a small, fake backtrace, otherwise programs terminate
+      with no output at all, in case of a runtime error }
+    if addr=CodePointer($eeeeeeef) then
+      result:=CodePointer($eeeeeeee)
+    else
+      result:=nil;
   end;