Source code exception location based on pstack

Hi,

I have a core that's caused by an exception. pstack tells me the offending function and also the hex offset inside that function, and I need to get to the exact line in my source file.

The way I used to do that in the past was to generate a .s from the .C using the -S option of CC, but the recent version of CC that I have doesn't show the source line number inside the .s.

Please let me know how can I get to the exact line in the source file from the core / pstack.

Regards,

Sachin

[527 byte] By [bronze-starDukes] at [2007-11-26 12:14:56]
# 1

Even without the help from the compiler you can still figure out which c-statement the

failed instruction maps to, but, as you guessed it, it is little painful (A little bit of

familiarity with assembly will come in handy here) :

In mdb, take the instruction pstack reported, and use '::dis' to get instructions around the

failing one. From the o/p, look for the following sign posts :

- any function calls

- any sethi calls, sparc uses sethi to load any constants

- any jmpl calls (function pointers translate to jmpl calls)

- any loops for/while - these generally will have ba/be/bne to some other location.

With the above info, look out where these figure in the corresponding C-routine.

If the function is really huge, the above can get iterative and more painful.

With regard to the -S option, you may want to ask in compiler/studio forums !!

-surya

bronzestar at 2007-7-7 14:18:10 > top of Java-index,Archived Forums,Socket Programming...
# 2
Thanks a lot for the tips Surya, shall try that out.
bronzestar at 2007-7-7 14:18:10 > top of Java-index,Archived Forums,Socket Programming...