source line mapping in .s
Hi,
I use CC compiler on Solaris. -S option to earlier version of CC used to provide a mapping between the C/C++ source line number and the equivalent assembly code. But the version of CC available with me doesn't provide source line number in .s anymore. I need this mapping to be able to identify the line number causing exception from the offset available in pstack. Could anyone please tell me how can I get this mapping in .s ? Is there any other option ?
Regards,
Sachin
[502 byte] By [
_s_r_s_a] at [2007-11-26 12:34:07]

# 16
I sometimes run into a similar situation where I have DTrace-generated
stack traces which provide symbol+offset address that I'd like to map to
high level source lines.
I could probably re-run under dbx to the same point that triggered the
DTrace probe, but it wouldn't always be trivial. [If it were trivial,
I wouldn't have needed to use DTrace to track it down :-) ]
I'd *like* to be able to use some hypothetical dbx command like:
(dbx) lineinfo beta+0x344
==> beta(), line 541 in "supportutils.c"
I used to use the "list -i" command:
(dbx) list -i beta
... source + disassembly listing ...
and manually find the symbol+offset that I'm interested in. Now I use a
"hack" which I have encapsulated into a script which runs the executable
up to "_start" (just to load the shared objects without running any of the
logic of the program), then set the PC to the address in question and
issue a "where" or "list" command:
(dbx) stop in _start
(dbx) run
(dbx) assign $pc=beta+0x344
(dbx) where
=>[1] beta(sz = 0), line 541 in "supportutils.c"
This occasionally works, but usually I have to execute a single "stepi"
command before the high level line number is available. I'm not sure why
that "stepi" is needed.
(dbx) stepi
(dbx) where
=>[1] beta(sz = 0), line 541 in "supportutils.c"
I cringe at executing some arbitrary instruction from the target function
using the "_start" stack frame, but this hack generally seems to do what I
want.
I suspect I've built a Rube Goldberg solution to a simple problem, so I'd
like to ask if there's a simple/robust way to do this mapping within dbx.
-morgan