This is the mail archive of the binutils@sources.redhat.com 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]

RE: Regarding Map Files


Hi

We have two options. One is clear and we are using it. i.e.
Program logs its own flow to debug log which can be enabled
and disabled. There are some problems with this approach

1) Size of debug log. Its cumbersome for support engineer
   or customer to enable logging, duplicate bug and ship
   the huge logs to developer site. Further its a pain
   for developers to trace log entries.

2) Bug which appears while logging is off may not appear
   when the same is enabled even though it can be
   duplicated.

3) Size of executables.

Second approach is that when program finds an error condition
or OS reports to it through signals, programs calls an internal
function which then only logs few numbers which are nothing
but return addresses on the stack. These numbers will be emitted
only in case of bugs. They are definitely shorter than the core dump
given by OS. I agree the core dump already contains these numbers
we are interested in. This is the first obstacle in this approach.

Now second obstacle is that once we have these numbers corresponding
to an optimized executable, is it possible to figure out approximate
range of line numbers in the source code.

Utilities like 'gdb' and 'addr2line' gives this information if these
numbers correspond to the unoptimized executables with debugging info.
For optimized versions can one use map files generated by linker?

First obstacle has a solution in Windows as there is a specific call
for getting stack trace. For second obstacle one need to manually
trace the map files generated by VC++ linker. A tool can be easily
written for the same.

--
Thanks
Sachin
--



> -----Original Message-----
> From: Shridhar Bhat [mailto:penguin@pspl.co.in]
> Sent: Thursday, December 20, 2001 7:28 PM
> To: Sachin O. Agrawal
> Cc: Devendra Badhani (E-mail)
> Subject: RE: Regarding Map Files
> 
> 
> Hi Sachin,
> 
> If the program can detect error conditions on its own then you
> could definitely do this. But the problem is that when the
> program does something wrong, in most cases, it is the OS
> which detects this error and creates the core dump. So, program
> would have no way to figure this out. If you could modify the
> OS (or the run time system) to send a special signal to the 
> program, which the program could catch and intelligently 
> create its own stack trace, then it would work.
> 
> Correct me if I am wrong.
> 
> -Shridhar.
> 
> On Thu, 20 Dec 2001, Sachin O. Agrawal wrote:
> 
> :>Hello,
> :>
> :>Actually my intention is to find the functions and approximate
> :>range of line numbers in sources given an address.
> :>
> :>Usually all commercial products use logging to trace their code
> :>flow in case of error at customer site. My opinion is that in
> :>error conditions program itself can log stack back trace just
> :>like a debugger (but within an optimized code).
> :>
> :>Support engineer or customer will mail these numbers instead of
> :>big and huge core dump to the developers. Developers will then
> :>trace out using map files the backtrace. I agree this trace
> :>won't be as accurate as backtrace reported by debugger but
> :>at least it is better than huge logging.
> :>
> :>--
> :>Thanks
> :>Sachin
> :>--
> :>
> :>
> :>-----Original Message-----
> :>From: ananda.motte@philips.com [mailto:ananda.motte@philips.com]
> :>Sent: Thursday, December 20, 2001 6:34 PM
> :>To: sachin_agrawal@persistent.co.in
> :>Subject: Re: Regarding Map Files
> :>
> :>
> :>
> :>Basically it tells you in what portions of memory your 
> .text .rodata .bss
> :>.data and other sections (read GNU manual) and their 
> respective symbol
> :>contents are loaded and relocated to in case your image 
> address is different
> :>from the load address.
> :>
> :>Ir Motte dit Falisse Ananda
> :>Embedded Software Engineer
> :>Portable Audio
> :>Philips Semiconductors Leuven, Belgium
> :>
> :>> -----Original Message-----
> :>> From: Sachin O. Agrawal [mailto:sachin_agrawal@persistent.co.in]
> :>> Sent: Thursday, December 20, 2001 6:05 PM
> :>> To: 'binutils@sources.redhat.com'
> :>> Subject: Regarding Map Files
> :>>
> :>>
> :>> Hello,
> :>>
> :>> With -M or -Map option to the ld linker, we can create a map file.
> :>> Does any one knows how to interpret them?
> :>>
> :>> --
> :>> Thanks
> :>> Sachin
> :>> --
> :>
> :>
> 
> 


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