From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: addr2line i mingw gcc 4.4.0
Date: Sat, 27 Jun 2009 14:29:34 +0200
Date: 2009-06-27T14:29:34+02:00 [thread overview]
Message-ID: <1lj06mpzo0kub$.1smjw0922rv52$.dlg@40tude.net> (raw)
In-Reply-To: uab3tkja7.fsf@stephe-leake.org
On Sat, 27 Jun 2009 07:28:32 -0400, Stephen Leake wrote:
> Ludovic Brenta <ludovic@ludovic-brenta.org> writes:
>
>> libaddr2line.a is an invention from AdaCore several years ago; it is a
>> patch against the program "addr2line" in certain versions of binutils,
>> not GCC. I am not aware of any binary distribution of it apart from
>> AdaCore's own. In Debian, I've patched GCC so that it supports
>> symbolic tracebacks by calling addr2line in an external process rather
>> than using libaddr2line in-process. An early version of this patch
>> was in the Ada for Linux Team distribution by J�rgen Pfeiffer for Red
>> Hat Linux 6 (in 1999).
>>
>> So, I think you can have symbolic tracebacks in mingw in one of two
>> ways: patch binutils to build libaddr2line.a then link libgnat against
>> it; or patch libgnat to use the same method as on Debian.
>
> A third alternative is to output numeric traceback from the failing
> program, and then use addr2line (the program) to get the symbolic
> traceback in a separate manual step.
It is quite simple to print the symbolic traceback from the program:
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Traceback; use GNAT.Traceback;
with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic;
procedure Call_Stack is
TB : Tracebacks_Array (1..100);
Len : Natural;
begin
Call_Chain (TB, Len);
Put_Line (Symbolic_Traceback (TB (1..Len)));
end Call_Stack;
This prints the call stack. I am using this for tracing Gtk errors before
they corrupt the stack due to exception propagation.
Note that Tracebacks_Array is merely an array of addresses, so if you get
it in other way, for example, from Exception_Information, you can convert
each number there to Address (using System.Storage_Elements.To_Address) and
then pass the result to (Symbolic_Traceback.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2009-06-27 12:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-26 14:41 addr2line i mingw gcc 4.4.0 björn lundin
2009-06-26 20:56 ` sjw
2009-06-26 21:28 ` björn lundin
2009-06-27 0:00 ` Ludovic Brenta
2009-06-27 11:28 ` Stephen Leake
2009-06-27 12:29 ` Dmitry A. Kazakov [this message]
2009-06-27 13:05 ` Ludovic Brenta
2009-06-27 16:24 ` sjw
2009-06-27 18:50 ` björn lundin
2009-06-27 20:49 ` Georg Bauhaus
2009-06-29 21:49 ` Randy Brukardt
2009-06-28 16:20 ` sjw
2009-06-27 17:09 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox