From 9f3567a554b78b200ea91cb66e5945a80fd0ceb3 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 2 Jun 2016 20:26:09 +0200 Subject: Handle default parameters for file_open. Display backtrace for error in file_open. --- src/grt/grt-files.adb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/grt') diff --git a/src/grt/grt-files.adb b/src/grt/grt-files.adb index 1f037a76e..a47381289 100644 --- a/src/grt/grt-files.adb +++ b/src/grt/grt-files.adb @@ -245,15 +245,18 @@ package body Grt.Files is (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr) is Res : Ghdl_I32; + Bt : Backtrace_Addrs; begin Check_File_Mode (File, True); Res := File_Open (File, Mode, Str); if Res /= Open_Ok then - Error_C ("open: cannot open text file "); + Save_Backtrace (Bt, 1); + Error_C ("cannot open text file """); Error_C_Std (Str.Base (0 .. Str.Bounds.Dim_1.Length - 1)); - Error_E; + Error_C (""""); + Error_E_Call_Stack (Bt); end if; end Ghdl_Text_File_Open; @@ -261,15 +264,18 @@ package body Grt.Files is (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr) is Res : Ghdl_I32; + Bt : Backtrace_Addrs; begin Check_File_Mode (File, False); Res := File_Open (File, Mode, Str); if Res /= Open_Ok then - Error_C ("open: cannot open file "); + Save_Backtrace (Bt, 1); + Error_C ("cannot open file """); Error_C_Std (Str.Base (0 .. Str.Bounds.Dim_1.Length - 1)); - Error_E; + Error_C (""""); + Error_E_Call_Stack (Bt); end if; end Ghdl_File_Open; -- cgit v1.2.3