This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Improvements in binutils by implementing libaddr2line.a


The GNU binutils contains a useful program addr2line that converts addresses
into filenames and line numbers.
With an simple extension it is possible to create a library (libaddr2line
that I think was exist is in the past but now it is no more released ???)
exporting the function convert_addresses(.).
This library it is useful for the GNAT (GCC Ada compiler) in order to report
file and line number of the ada exception.
Current releases of binutils and consequently GNAT doen't contains this
library and it is very difficult to examines, every time an exception raise,
what are the lines by the offline program addr2line. The GNAT is
configurable in order to used this library but only a few target implements
it (as reported in adainit.c file).
For each target that the program addr2line is created it is possible to
create the libadddr2line.
Besides, used in conjunction with the function backtrace in execinfo.h of
glibc it is more flexible and supply more information to report the stack
trace of the program (like that in java).

I implemented this routine integrated with addr2line.c and in particular I
implemented this files:
1. general_addr2line.c: extension of the addr2line.c in order to export
convert_addresses function.
2. gnat_addr2line.c: extension of the addr2line.c to be used with GNAT (I
think it is necessary to chage how gnat see this function because with this
implementation the library need to known the symbols:  gnat_argv and
__gnat_locate_exec_on_path not present in program that doesn't use gnat ada
language. In this case it is necessary to change the adainit.c file present
in GCC distribution to align to the format of the function in
general_addr2line.c.
3. Commands_for_create_libaddr2line.txt : Commands used to generate the
library that will be integrated in binutils makefiles
4. prova_bt.c: C examples using backtrace and convert_addresses routine.

These are the files used by the test executed and there are an examples how
to implement it (I copied and modified an old file gnaddr2line.c)
I will happy to send you this files if you want.

Thank you in advance and sorry for my low level English.

Bye 
Massimo Bozzetti



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]