I understand there is system call mt__trce
, but I would like an API method to give the call stack information that I can use in a C++ program. Is there such a method?
Asked
Active
Viewed 763 times
3

Toby Speight
- 27,591
- 48
- 66
- 103

Muru
- 27
- 2
-
mmm, is that Windows, Linux or Mac or what? – ForceBru Mar 29 '16 at 16:27
-
1@ForceBru: tags (and subject) says AIX – Toby Speight Mar 29 '16 at 16:28
-
1@ForceBru: Neither. AIX is IBM's proprietary Unix operating system. – doynax Mar 29 '16 at 16:28
-
With xlc, using `mt__trce` to dump a core for later analysis appears to be all you can do. If using glibc, you can use `backtrace()`. Look at the more generic question http://stackoverflow.com/questions/105659/how-can-one-grab-a-stack-trace-in-c ; several answers there give alternatives that may solve your problem. – patrickmdnet Jun 25 '16 at 20:35
-
@TobySpeight I´ve tried to do the same that you attempted and did not suceeded Have you found any way to dissect context->uc_mcontext.jmp_context aix structure to get PC and SP? My searches send me to this answer (bottom) that seems to get a backtrace, but i cant find the arm_pc or the gregs[REG_PC] structure on AIX. I should use them to get PC and SP and them get functions. http://stackoverflow.com/questions/29559347/how-to-unwind-the-stack-to-get-backtrace-for-the-specified-stack-pointer-sp – LeoPucciBr Mar 24 '17 at 18:17