Commit 9328056b by Dmitriy Anisimkov Committed by Pierre-Marie de Rodat

[Ada] GNAT.Traceback: add a Call_Chain function

2019-07-05  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

	* libgnat/g-traceb.ads, libgnat/g-traceb.adb (Call_Chain): New
	function.

From-SVN: r273101
parent 0f146681
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
......
......@@ -41,10 +41,20 @@ package body GNAT.Traceback is
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;
......@@ -98,4 +98,13 @@ package GNAT.Traceback is
-- 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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment