~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to include/my_dbug.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000 MySQL AB
 
1
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
#ifndef _dbug_h
17
 
#define _dbug_h
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
15
*/
 
16
 
 
17
#ifndef MY_DBUG_INCLUDED
 
18
#define MY_DBUG_INCLUDED
 
19
 
 
20
#ifndef __WIN__
 
21
#ifdef HAVE_SYS_TYPES_H
 
22
#include <sys/types.h>
 
23
#endif
 
24
#ifdef HAVE_UNISTD_H
 
25
#include <unistd.h>
 
26
#endif
 
27
#include <signal.h>
 
28
#endif  /* not __WIN__ */
18
29
 
19
30
#if defined(__cplusplus) && !defined(DBUG_OFF)
20
31
class Dbug_violation_helper
69
80
extern  void _db_lock_file_(void);
70
81
extern  void _db_unlock_file_(void);
71
82
extern FILE *_db_fp_(void);
 
83
extern  void _db_flush_();
72
84
 
73
85
#ifdef __cplusplus
74
86
 
124
136
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
125
137
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
126
138
#define IF_DBUG(A) A
 
139
#ifndef __WIN__
 
140
#define DBUG_ABORT()                    (_db_flush_(), abort())
 
141
#else
 
142
/*
 
143
  Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can
 
144
  call abort() instead of _exit(3) (now it would cause a "test signal" popup).
 
145
*/
 
146
#include <crtdbg.h>
 
147
#define DBUG_ABORT() (_db_flush_(),\
 
148
                     (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
 
149
                     (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
 
150
                     _exit(3))
 
151
#endif
 
152
 
 
153
/*
 
154
  Make the program fail, without creating a core file.
 
155
  abort() will send SIGABRT which (most likely) generates core.
 
156
  Use SIGKILL instead, which cannot be caught.
 
157
  We also pause the current thread, until the signal is actually delivered.
 
158
  An alternative would be to use _exit(EXIT_FAILURE),
 
159
  but then valgrind would report lots of memory leaks.
 
160
 */
 
161
#ifdef __WIN__
 
162
#define DBUG_SUICIDE() DBUG_ABORT()
 
163
#else
 
164
extern void _db_suicide_();
 
165
#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
 
166
#endif
 
167
 
127
168
#else                                           /* No debugger */
128
169
 
129
170
#define DBUG_ENTER(a1)
152
193
#define DBUG_EXPLAIN(buf,len)
153
194
#define DBUG_EXPLAIN_INITIAL(buf,len)
154
195
#define IF_DBUG(A)
 
196
#define DBUG_ABORT()                    do { } while(0)
 
197
#define DBUG_SUICIDE()                  do { } while(0)
 
198
 
155
199
#endif
156
200
#ifdef  __cplusplus
157
201
}
158
202
#endif
159
 
#endif
 
203
 
 
204
#endif /* MY_DBUG_INCLUDED */