~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/stacktrace.cc

  • Committer: Brian Aker
  • Date: 2010-04-05 23:46:43 UTC
  • Revision ID: brian@gaz-20100405234643-0he3xnj902rc70r8
Fixing tests to work with PBXT.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "drizzled/global.h"
21
 
#include "stacktrace.h"
 
20
#include "config.h"
 
21
#include "drizzled/stacktrace.h"
 
22
#include <cstddef>
22
23
 
23
24
#include <signal.h>
24
 
#include <mysys/my_pthread.h>
25
 
#include <mystrings/m_string.h>
 
25
#include "drizzled/internal/my_pthread.h"
 
26
#include "drizzled/internal/m_string.h"
26
27
#ifdef HAVE_STACKTRACE
27
28
#include <unistd.h>
28
29
#include <strings.h>
31
32
#include <execinfo.h>
32
33
#endif
33
34
 
 
35
#include <cstring>
 
36
#include <cstdio>
34
37
#include <algorithm>
35
38
 
 
39
#include "drizzled/definitions.h"
 
40
 
36
41
using namespace std;
37
42
 
 
43
namespace drizzled
 
44
{
 
45
 
38
46
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
39
47
 
40
48
char *heap_start;
169
177
  fprintf(stderr, "Stack range sanity check OK, backtrace follows:\n");
170
178
 
171
179
  /* We are 1 frame above signal frame with NPTL and 2 frames above with LT */
172
 
  sigreturn_frame_count = thd_lib_detected == THD_LIB_LT ? 2 : 1;
 
180
  sigreturn_frame_count = internal::thd_lib_detected == THD_LIB_LT ? 2 : 1;
173
181
 
174
182
  while (fp < (unsigned char**) stack_bottom)
175
183
  {
199
207
          "problem, so please do resolve it\n");
200
208
}
201
209
#endif /* TARGET_OS_LINUX */
 
210
 
 
211
} /* namespace drizzled */
 
212
 
202
213
#endif /* HAVE_STACKTRACE */
203
214
 
204
215
/* Produce a core for the thread */
205
216
 
 
217
namespace drizzled
 
218
{
 
219
 
206
220
void write_core(int sig)
207
221
{
208
222
  signal(sig, SIG_DFL);
221
235
  sigsend(P_PID,P_MYID,sig);
222
236
#endif
223
237
}
 
238
 
 
239
} /* namespace drizzled */