Some missing from merge.

Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
Salja 2012-08-05 14:54:07 +02:00 committed by Antz
parent ec939a5bce
commit f4be15a7af
1895 changed files with 160408 additions and 53601 deletions

View file

@ -2,6 +2,8 @@
/**
* @file Stack_Trace.cpp
*
* $Id: Stack_Trace.cpp 96017 2012-08-08 22:18:09Z mitza $
*
* @brief Encapsulate string representation of stack trace.
*
* Some platform-specific areas of this code have been adapted from
@ -20,6 +22,7 @@
*
* If you add support for a new platform, please add a bullet to the
* above list with durable references to the origins of your code.
*
*/
//=============================================================================
@ -28,8 +31,6 @@
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_stdio.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/*
This is ugly, simply because it's very platform-specific.
*/
@ -57,16 +58,7 @@ determine_starting_frame (ssize_t initial_frame, ssize_t offset)
return ACE_MAX( initial_frame + offset, static_cast<ssize_t>(0));
}
#if defined(ACE_FACE_SAFETY_BASE) && !defined(ACE_FACE_DEV)
void
ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, size_t num_frames)
{
ACE_UNUSED_ARG (starting_frame_offset);
ACE_UNUSED_ARG (num_frames);
ACE_OS::strcpy (&this->buf_[0], UNABLE_TO_GET_TRACE);
}
#elif (defined(__GLIBC__) || defined(ACE_HAS_EXECINFO_H)) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
#if (defined(__GLIBC__) || defined(ACE_HAS_EXECINFO_H)) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
// This is the code for glibc
# include <execinfo.h>
@ -134,9 +126,9 @@ static ACE_Stack_Trace_stackstate* ACE_Stack_Trace_stateptr = 0;
static void
ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller,
INSTR *func,
int nargs,
ACE_VX_USR_ARG_T *args)
unsigned int func,
unsigned int nargs,
unsigned int *args)
{
if (ACE_Stack_Trace_stateptr == 0)
return;
@ -154,21 +146,20 @@ ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller,
// These are references so that the structure gets updated
// in the code below.
char*& buf = stackstate->buf;
size_t& len = stackstate->buflen;
unsigned int& len = stackstate->buflen;
// At some point try using symFindByValue() to lookup func (and caller?)
// to print out symbols rather than simply addresses.
// VxWorks can pass -1 for "nargs" if there was an error
if (nargs == -1)
nargs = 0;
if (nargs == static_cast<unsigned int> (-1)) nargs = 0;
len += ACE_OS::sprintf (&buf[len], "%p: %p (", caller, func);
for (int i = 0; i < nargs; ++i)
len += ACE_OS::sprintf (&buf[len], "%#10x: %#10x (", (int)caller, func);
for (unsigned int i = 0; i < nargs; ++i)
{
if (i != 0)
len += ACE_OS::sprintf (&buf[len], ", ");
len += ACE_OS::sprintf(&buf[len], "0x" ACE_VX_ARG_FORMAT, args[i]);
len += ACE_OS::sprintf(&buf [len], "%#x", args [i]);
}
len += ACE_OS::sprintf(&buf[len], ")\n");
@ -192,7 +183,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
REG_SET regs;
taskRegsGet (taskIdSelf(), &regs);
taskRegsGet ((int)taskIdSelf(), &regs);
// Maybe we should take a lock here to guard stateptr?
ACE_Stack_Trace_stateptr = &state;
trcStack (&regs, (FUNCPTR)ACE_Stack_Trace_Add_Frame_To_Buf, taskIdSelf ());
@ -264,6 +255,17 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset,
const char *fnName = "(no symbols)";
static const int N_ARGS = 12;
#if (ACE_VXWORKS < 0x690)
# define ACE_VX_USR_ARG_T int
# define ACE_VX_ARG_FORMAT "%x"
#else
# define ACE_VX_USR_ARG_T _Vx_usr_arg_t
# ifdef _WRS_CONFIG_LP64
# define ACE_VX_ARG_FORMAT "%lx"
# else
# define ACE_VX_ARG_FORMAT "%x"
# endif
#endif
ACE_VX_USR_ARG_T buf[N_ARGS];
ACE_VX_USR_ARG_T *pArgs = 0;
int numArgs =
@ -735,4 +737,3 @@ ACE_Stack_Trace::generate_trace (ssize_t, size_t)
}
#endif
ACE_END_VERSIONED_NAMESPACE_DECL