~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/stacktrace.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 00:53:34 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913005334-6wio2sbjugskfbm3
Added calls to the connection start/end dtrace probes.

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