diff options
author | Tristan Gingold | 2015-11-18 21:45:45 +0100 |
---|---|---|
committer | Tristan Gingold | 2015-11-19 05:47:59 +0100 |
commit | 92b0b82ea32982b94eb8bf19a0b498d92053fffe (patch) | |
tree | 70b04f103d145dc01d31870e50b5e6a654dc20e0 /src/grt/grt-errors.adb | |
parent | ff4bc5fb13a997a1d00596578b6d7deb5c0b0da6 (diff) | |
download | ghdl-92b0b82ea32982b94eb8bf19a0b498d92053fffe.tar.gz ghdl-92b0b82ea32982b94eb8bf19a0b498d92053fffe.tar.bz2 ghdl-92b0b82ea32982b94eb8bf19a0b498d92053fffe.zip |
Add symbolizer (for mcode).
Display a backtrace in case of failed check or assert failure.
Diffstat (limited to 'src/grt/grt-errors.adb')
-rw-r--r-- | src/grt/grt-errors.adb | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/grt/grt-errors.adb b/src/grt/grt-errors.adb index 62ee86e..56d1e6f 100644 --- a/src/grt/grt-errors.adb +++ b/src/grt/grt-errors.adb @@ -26,6 +26,7 @@ with Grt.Stdio; use Grt.Stdio; with Grt.Astdio; use Grt.Astdio; with Grt.Options; use Grt.Options; with Grt.Hooks; use Grt.Hooks; +with Grt.Backtraces; package body Grt.Errors is -- Called in case of premature exit. @@ -76,6 +77,11 @@ package body Grt.Errors is Put (stderr, Str); end Put_Err; + procedure Put_Err (C : Character) is + begin + Put (stderr, C); + end Put_Err; + procedure Put_Err (Str : Ghdl_C_String) is begin Put (stderr, Str); @@ -254,13 +260,34 @@ package body Grt.Errors is Fatal_Error; end Internal_Error; - procedure Grt_Overflow_Error is + procedure Error_E_Call_Stack (Bt : Backtrace_Addrs) is + begin + Newline_Err; + + Grt.Backtraces.Put_Err_Backtrace (Bt); + + Cont := False; + Fatal_Error; + end Error_E_Call_Stack; + + procedure Error_E_Call_Stack (Bt : Backtrace_Addrs_Acc) is + begin + if Bt /= null then + Error_E_Call_Stack (Bt.all); + else + Error_E; + end if; + end Error_E_Call_Stack; + + procedure Grt_Overflow_Error (Bt : Backtrace_Addrs_Acc) is begin - Error ("overflow detected"); + Error_C ("overflow detected"); + Error_E_Call_Stack (Bt); end Grt_Overflow_Error; - procedure Grt_Null_Access_Error is + procedure Grt_Null_Access_Error (Bt : Backtrace_Addrs_Acc) is begin - Error ("NULL access dereferenced"); + Error_C ("NULL access dereferenced"); + Error_E_Call_Stack (Bt); end Grt_Null_Access_Error; end Grt.Errors; |