List:Commits« Previous MessageNext Message »
From:mikael Date:February 3 2006 3:53pm
Subject:bk commit into 5.1 tree (mikron:1.2106)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2106 06/02/03 16:53:35 mikron@stripped +2 -0
  WL 2826: Eigth step
  Inserted monty patch to allow for adding and dropping
  DBUG keywords per thread

  include/my_dbug.h
    1.18 06/02/03 16:53:22 mikron@stripped +7 -1
    Inserted monty patch to allow for adding and dropping
    DBUG keywords per thread

  dbug/dbug.c
    1.22 06/02/03 16:53:22 mikron@stripped +82 -5
    Inserted monty patch to allow for adding and dropping
    DBUG keywords per thread

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mikron
# Host:	c-130be253.1238-1-64736c10.cust.bredbandsbolaget.se
# Root:	/Users/mikron/wl2826

--- 1.21/dbug/dbug.c	2004-12-18 04:19:14 +01:00
+++ 1.22/dbug/dbug.c	2006-02-03 16:53:22 +01:00
@@ -249,6 +249,7 @@
   uint u_line;			/* User source code line number */
   int  locked;			/* If locked with _db_lock_file */
   const char *u_keyword;	/* Keyword for current macro */
+  struct link *keywords;        /* Thread specific, active keywords */
 } CODE_STATE;
 
 	/* Parse a debug command string */
@@ -1252,7 +1253,9 @@
 BOOLEAN _db_strict_keyword_ (
 const char *keyword)
 {
-  if (stack -> keywords == NULL)
+  CODE_STATE *state;
+  if (stack->keywords == NULL &&
+      (!(state= code_state()) || state->keywords == NULL))
     return FALSE;
   return _db_keyword_ (keyword);
 }
@@ -1288,16 +1291,15 @@
   REGISTER BOOLEAN result;
   CODE_STATE *state;
 
-  if (!init_done)
-    _db_push_ ("");
-  /* Sasha: pre-my_thread_init() safety */
   if (!(state=code_state()))
     return FALSE;
   result = FALSE;
   if (DEBUGGING && !state->disable_output &&
       state->level <= stack -> maxdepth &&
       InList (stack -> functions, state->func) &&
-      InList (stack -> keywords, keyword) &&
+      (InList (stack -> keywords, keyword) ||
+       (state -> keywords &&
+        InList (state -> keywords, keyword))) &&
       InList (stack -> processes, _db_process_))
     result = TRUE;
   return (result);
@@ -1372,6 +1374,81 @@
   }
 }
 
+
+/*
+ *  FUNCTION
+ *
+ *	Add key word to _db_strict_keyword_ list
+ *
+ *  SYNOPSIS
+ *
+ *	VOID _db_add_strict_keyword(keyword)
+ *	const char *keyword;
+ *
+ *  DESCRIPTION
+ *
+ *	Add key word to _db_strict_keyword_ to active DEBUG_EXECUTE_IF
+ *      statements for this thread only
+ *
+ *      Returns TRUE if keyword accepted, FALSE otherwise.
+ *
+ */
+
+BOOLEAN _db_add_strict_keyword_(const char *keyword)
+{
+  CODE_STATE *state;
+  struct link *tmp;
+  uint length;
+
+  if (!(state=code_state()) ||
+      !(tmp= (struct link *) DbugMalloc(sizeof(struct link) +
+                                        (length= strlen(keyword)+1))))
+    return FALSE;
+  tmp->str= (char*) (tmp+1);
+  memcpy(tmp->str, keyword, length);
+  tmp->next_link= state->keywords;
+  state->keywords= tmp;
+  return TRUE;
+}
+
+/*
+ *  FUNCTION
+ *
+ *	Remove key word from thread specific _db_strict_keyword_ list
+ *
+ *  SYNOPSIS
+ *
+ *	VOID _db_del_strict_keyword_(keyword)
+ *	const char *keyword;
+ *
+ *  DESCRIPTION
+ *
+ *	Delete key word from _db_strict_keyword_ to decative DEBUG_EXECUTE_IF
+ *      statements for this thread only
+ *
+ *      Returns TRUE if keyword deleted, FALSE otherwise.
+ *
+ */
+
+BOOLEAN _db_del_strict_keyword_(const char *keyword)
+{
+  CODE_STATE *state;
+  struct link *link, **linkp;
+
+  if (!(state=code_state()))
+    return FALSE;
+
+  for (linkp= &state->keywords; (link= *linkp); linkp= &link->next_link)
+  {
+    if (STREQ(link->str, keyword))
+    {
+      *linkp= link->next_link;
+      free(link);      
+      return TRUE;
+    }
+  }
+  return (FALSE);
+}
 
 /*
  *  FUNCTION

--- 1.17/include/my_dbug.h	2006-02-03 16:41:13 +01:00
+++ 1.18/include/my_dbug.h	2006-02-03 16:53:22 +01:00
@@ -24,8 +24,10 @@
 extern	int _db_on_,_no_db_;
 extern	FILE *_db_fp_;
 extern	char *_db_process_;
-extern	int _db_keyword_(const char *keyword);
+extern  int _db_keyword_(const char *keyword);
 extern  int _db_strict_keyword_(const char *keyword);
+extern  int _db_add_strict_keyword_(const char *keyword);
+extern  int _db_del_strict_keyword_(const char *keyword);
 extern	void _db_setjmp_(void);
 extern	void _db_longjmp_(void);
 extern	void _db_push_(const char *control);
@@ -76,6 +78,8 @@
         (_db_on_ ? ((_db_strict_keyword_ (keyword)) ? ((a1), 0) : 0) : 0)
 #define DBUG_COND(keyword) \
         ((_db_on_ && _db_strict_keyword_ (keyword)) ? 1 : 0)
+#define DBUG_ADD_KEYWORD(key) _db_add_strict_keyword_(key)
+#define DBUG_DEL_KEYWORD(key) _db_del_strict_keyword_(key)
 #else						/* No debugger */
 
 #define DBUG_ENTER(a1)
@@ -85,6 +89,8 @@
 #define DBUG_EXECUTE_IF(keyword,a1) {}
 #define DBUG_EXECUTE_COND(keyword, a1) 0
 #define DBUG_COND(keyword) 0
+#define DBUG_ADD_KEYWORD(key)
+#define DBUG_DEL_KEYWORD(key)
 #define DBUG_PRINT(keyword,arglist) {}
 #define DBUG_PUSH(a1) {}
 #define DBUG_POP() {}
Thread
bk commit into 5.1 tree (mikron:1.2106)mikael6 Feb