aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormistachkin <mistachkin@noemail.net>2013-08-15 20:05:03 +0000
committermistachkin <mistachkin@noemail.net>2013-08-15 20:05:03 +0000
commitfc7df53aeeb2758534d5ce3c9cb17dbee7c483d1 (patch)
tree3ce4ffea3646a2f5d24f8786a123f5548fcae735 /src
parent26080d924120b24cdc93cd7ab84b98129a68f475 (diff)
parent1f28e0703fb33668db136898d03874832babf74f (diff)
downloadsqlite-fc7df53aeeb2758534d5ce3c9cb17dbee7c483d1.tar.gz
sqlite-fc7df53aeeb2758534d5ce3c9cb17dbee7c483d1.zip
Make it easy to attach a debugger the test fixture process prior to any tests being run.
FossilOrigin-Name: 53cd9ebfaf401c7932bf591e134a527c9962b88e
Diffstat (limited to 'src')
-rw-r--r--src/tclsqlite.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 6d2a51e5a..42f7bcdc3 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -41,6 +41,18 @@
#endif
#include <ctype.h>
+/* Used to get the current process ID */
+#if !defined(_WIN32)
+# include <unistd.h>
+# define GETPID getpid
+#elif !defined(_WIN32_WCE)
+# ifndef SQLITE_AMALGAMATION
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# endif
+# define GETPID (int)GetCurrentProcessId
+#endif
+
/*
* Windows needs to know which symbols to export. Unix does not.
* BUILD_sqlite should be undefined for Unix.
@@ -3746,7 +3758,16 @@ static void init_all(Tcl_Interp *interp){
#define TCLSH_MAIN main /* Needed to fake out mktclapp */
int TCLSH_MAIN(int argc, char **argv){
Tcl_Interp *interp;
-
+
+#if !defined(_WIN32_WCE)
+ if( getenv("BREAK") ){
+ fprintf(stderr,
+ "attach debugger to process %d and press any key to continue.\n",
+ GETPID());
+ fgetc(stdin);
+ }
+#endif
+
/* Call sqlite3_shutdown() once before doing anything else. This is to
** test that sqlite3_shutdown() can be safely called by a process before
** sqlite3_initialize() is. */