Operating System - HP-UX
1748169 Members
4162 Online
108758 Solutions
New Discussion юеВ

Re: Obtaining Function Callers Address - aCC HPUX 11.0

 
Chris_164
Contributor

Obtaining Function Callers Address - aCC HPUX 11.0

Is there a way to get the function callers address from a C++ program compiled with aCC? If function a() calls function b(), can b() determine that a() called him?

I'm looking for some hook similar to U_STACK_TRACE, but I don't need the entire stack trace.

2 REPLIES 2
ranganath ramachandra
Esteemed Contributor

Re: Obtaining Function Callers Address - aCC HPUX 11.0

the unwind library libcl gives you all this functionality through its sparsely documented APIs - the U_... calls (U_STACK_TRACE is one of them). whatever documentation i have read is in the PA-RISC 2.0 runtime architecture document for PA32. you should be able to find that one at
http://devresource.hp.com/drc/STK/docs/archive/rad_10_20.pdf

if i get more information on unwind library API documentation i will post it here.
 
--
ranga
[i work for hpe]

Accept or Kudo

ranganath ramachandra
Esteemed Contributor

Re: Obtaining Function Callers Address - aCC HPUX 11.0

i learnt from the folks that own the unwind library that the only other documentation available is on the IA unwind(5) man page and this document for PA64:
http://devresource.hp.com/drc/STK/docs/archive/unwind.pdf

i am attaching a sample program. this is only for PA64, though. the API seems to be a little different for PA32. you can run the attached file as a ksh script. i guess you'll have to assemble the header files from the pdfs !

bash-2.01$ ksh unw.tst
cc: "1.c", line 15: error 1610: Attempting to return value from function of type void.
cc: "2.c", line 18: warning 604: Pointers are not assignment-compatible.
cc: "2.c", line 18: warning 563: Argument #3 is not the correct type.
called from main
called from __pthread_create_system
called from ___exit
 
--
ranga
[i work for hpe]

Accept or Kudo