Encapsulate a string representation of a stack trace on supported platforms. Stack traces for code built with optimize=1 (or "Release" configs on Visual Studio) may be misleading (missng frames) due to inlining performed by the compiler, which is indepenent of the inline=0 / inline=1 build option and the ACE_INLINE / ACE_NO_INLINE macros.
More...
Encapsulate a string representation of a stack trace on supported platforms. Stack traces for code built with optimize=1 (or "Release" configs on Visual Studio) may be misleading (missng frames) due to inlining performed by the compiler, which is indepenent of the inline=0 / inline=1 build option and the ACE_INLINE / ACE_NO_INLINE macros.
A new conversion character, the question mark, was added to ACE_Log_Msg for stack trace logging. The %? conversion character was added as a convenience so that users need not instantiate an ACE_Stack_Trace instance solely for the purpose of printing it in an ACE logging message. The following are functionally equivalent:
These usage examples were shown in $ACE_ROOT/tests/Stack_Trace_Test.cpp.
- Note
- The stack trace functionality was currently supported on platforms:
- Any platform using glibc as its runtime library, or where ACE_HAS_EXECINFO_H is defined (this covers Linux and Mac) and gcc version >= 3.3.
- VxWorks, both kernel and RTP
- Solaris
- Windows 32 and 64 bit (Visual C++, excluding WinCE/mobile)
-
Since stack trace buffer size has limitation(
ACE_STACK_TRACE_SYMBUFSIZ
), you will not get a complete stack trace if ACE_STACK_TRACE_SYMBUFSIZ
value is less than actual stack trace data length. To get a complete stack trace, you need set ACE_STACK_TRACE_SYMBUFSIZ
with a larger value that is enough for the stack trace data in your config.h
file and rebuild ACE.
-
Using ACE logging mechanism (%?) to log the stack trace also has ACE_MAXLOGMSGLEN size limitation. To get a complete stack trace, you could use different output method. Following is an example.