+2019-07-05 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * libgnat/g-traceb.ads, libgnat/g-traceb.adb (Call_Chain): New
+ function.
+
2019-07-04 James Clarke <jrtc27@debian.org>
* libgnarl/s-osinte__kfreebsd-gnu.ads (clockid_t): Make type
procedure Call_Chain
(Traceback : out Tracebacks_Array;
- Len : out Natural)
- is
+ Len : out Natural) is
begin
System.Traceback.Call_Chain (Traceback, Traceback'Length, Len);
end Call_Chain;
+ function Call_Chain
+ (Max_Len : Positive; Skip_Frames : Natural := 1) return Tracebacks_Array
+ is
+ Traceback : Tracebacks_Array (1 .. Max_Len);
+ Len : Natural;
+ begin
+ System.Traceback.Call_Chain
+ (Traceback, Max_Len, Len, Skip_Frames => Skip_Frames + 1);
+ return Traceback (1 .. Len);
+ end Call_Chain;
+
end GNAT.Traceback;
-- shorter, in which case positions in Traceback past the Len position
-- are undefined on return.
+ function Call_Chain
+ (Max_Len : Positive; Skip_Frames : Natural := 1) return Tracebacks_Array;
+ -- Returns up to Max_Len tracebacks corresponding to the current call
+ -- chain. Result array order is the same as in above procedure Call_Chain
+ -- except that Skip_Frames says how many of the most recent calls should be
+ -- excluded from the result, starting with this procedure itself: 1 means
+ -- exclude the frame for this procedure, 2 means 1 + exclude the frame for
+ -- this procedure's caller, ...
+
end GNAT.Traceback;