EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Problems with database breakpoint routines.
From: Andrew Johnson <[email protected]>
To: "Rees, NP (Nick)" <[email protected]>
Cc: EPICS core-talk <[email protected]>
Date: Tue, 19 Dec 2006 12:41:33 -0600
Hi Nick,

Rees, NP (Nick) wrote:

Thanks. Could you send me the revised files back so we don't get out of
sync. I have been doing a bit more investigation and there are still
some issues. I'd like to sort it out so I understand it.

Attached: the breakpoint changes since the official R3.14.9-pre2 release. Apply patch in the base/src directory.

- Andrew
--
There is considerable overlap between the intelligence of the smartest
bears and the dumbest tourists -- Yosemite National Park Ranger
Index: db/dbAccess.c
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/db/dbAccess.c,v
retrieving revision 1.116.2.10
retrieving revision 1.116.2.11
diff -u -b -r1.116.2.10 -r1.116.2.11
--- db/dbAccess.c	6 Dec 2006 17:10:26 -0000	1.116.2.10
+++ db/dbAccess.c	19 Dec 2006 16:20:47 -0000	1.116.2.11
@@ -535,7 +535,7 @@
          */
  
         /* see if there are any stopped records or breakpoints */
-        if (lset_stack_not_empty) {
+        if (lset_stack_count != 0) {
            /*
             *  Check to see if the record should be processed
             *   and activate breakpoint accordingly.  If this
@@ -624,7 +624,7 @@
 	/* process record */
 	status = (*prset->process)(precord);
         /* Print record's fields if PRINT_MASK set in breakpoint field */
-        if (lset_stack_not_empty) {
+        if (lset_stack_count != 0) {
                 dbPrint(precord);
         }
 all_done:
Index: db/dbBkpt.c
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/db/dbBkpt.c,v
retrieving revision 1.29
retrieving revision 1.29.2.1
diff -u -b -r1.29 -r1.29.2.1
--- db/dbBkpt.c	12 Jul 2002 21:33:40 -0000	1.29
+++ db/dbBkpt.c	19 Dec 2006 16:20:47 -0000	1.29.2.1
@@ -141,7 +141,7 @@
  *    normal record execution, i.e. when there aren't
  *    any breakpoints set.
  */
-long lset_stack_not_empty = 0;
+long lset_stack_count = 0;
 
 /*
  *  Stack--in which each entry represents a different
@@ -154,7 +154,7 @@
  *    operating with this stack.
  */
 static ELLLIST lset_stack;
-static epicsMutexId bkpt_stack_sem;
+static epicsMutexId bkpt_stack_sem = 0;
 
 /*
  *  Stores the last lockset continued or stepped from.
@@ -251,6 +251,18 @@
 
 
 /*
+ *  Initialise the breakpoint stack
+ */
+void epicsShareAPI dbBkptInit(void)
+{
+    if (! bkpt_stack_sem) {
+        bkpt_stack_sem = epicsMutexMustCreate();
+        ellInit(&lset_stack);
+        lset_stack_count = 0;
+    }
+}
+
+/*
  *  Add breakpoint to a lock set
  *     1. Convert name to address and check breakpoint mask.
  *     2. Lock database.
@@ -290,17 +302,6 @@
   *  Add lock set to the stack of lock sets that
   *    contain breakpoints and/or stopped records.
   */
-  if (! lset_stack_not_empty) {
-    /* initialize list and semaphore */
-     bkpt_stack_sem = epicsMutexCreate();
-     if (bkpt_stack_sem == 0) {
-        printf("   BKPT> epicsMutexCreate failed\n");
-        dbScanUnlock(precord);
-        return(1);
-     }
-     ellInit(&lset_stack);
-     lset_stack_not_empty = 1;
-  }
 
   epicsMutexMustLock(bkpt_stack_sem);
 
@@ -335,7 +336,9 @@
      pnode->taskid   = 0;
      pnode->step     = 0;
      pnode->l_num    = dbLockGetLockId(precord);
+
      ellAdd(&lset_stack, (ELLNODE *)pnode);
+     ++lset_stack_count;
   }
 
  /*
@@ -604,11 +607,11 @@
 
    /* Reset precord. (Since no records are at a breakpoint) */
     pnode->precord = NULL;
-  }
-  while (ellCount(&pnode->bp_list) != 0);
+  } while (ellCount(&pnode->bp_list) != 0);
 
  /* remove node from lockset stack */
   ellDelete(&lset_stack, (ELLNODE *)pnode);
+  --lset_stack_count;
 
   {
     /*
@@ -634,14 +637,6 @@
  /* free list node */
   free(pnode);
 
- /* if last node on stack ... */
-  if (ellCount(&lset_stack) == 0) {
-      /* Unset flag, delete stack semaphore */
-       lset_stack_not_empty = 0;
-       epicsMutexDestroy(bkpt_stack_sem);
-  }
-
-  if (lset_stack_not_empty)
      epicsMutexUnlock(bkpt_stack_sem);
 }
 
Index: db/dbBkpt.h
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/db/dbBkpt.h,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -b -r1.11.2.1 -r1.11.2.2
--- db/dbBkpt.h	6 Dec 2006 17:10:26 -0000	1.11.2.1
+++ db/dbBkpt.h	19 Dec 2006 16:20:47 -0000	1.11.2.2
@@ -82,6 +82,7 @@
 
 #define MAX_EP_COUNT         99999
 
+epicsShareFunc void epicsShareAPI dbBkptInit(void);
 epicsShareFunc long epicsShareAPI dbb(const char *recordname);
 epicsShareFunc long epicsShareAPI dbd(const char *recordname);
 epicsShareFunc long epicsShareAPI dbc(const char *recordname);
@@ -90,11 +91,11 @@
 epicsShareFunc long epicsShareAPI dbp(
     const char *record_name, int interest_level);
 epicsShareFunc long epicsShareAPI dbap(const char *record_name);
-epicsShareFunc int  epicsShareAPI dbBkpt(dbCommon *precord);
-epicsShareFunc void epicsShareAPI dbPrint(dbCommon *precord);
+epicsShareFunc int  epicsShareAPI dbBkpt(struct dbCommon *precord);
+epicsShareFunc void epicsShareAPI dbPrint(struct dbCommon *precord);
 epicsShareFunc long epicsShareAPI dbprc(char *record_name);
 
-extern long lset_stack_not_empty;
+extern long lset_stack_count;
 
 #ifdef __cplusplus
 }
Index: misc/iocInit.c
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/misc/iocInit.c,v
retrieving revision 1.11.2.4
retrieving revision 1.11.2.5
diff -u -b -r1.11.2.4 -r1.11.2.5
--- misc/iocInit.c	31 Oct 2005 20:54:10 -0000	1.11.2.4
+++ misc/iocInit.c	19 Dec 2006 16:29:38 -0000	1.11.2.5
@@ -1,14 +1,13 @@
 /*************************************************************************\
-* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
+* Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne
 *     National Laboratory.
 * Copyright (c) 2002 The Regents of the University of California, as
 *     Operator of Los Alamos National Laboratory.
-* EPICS BASE Versions 3.13.7
-* and higher are distributed subject to a Software License Agreement found
+* EPICS BASE is distributed subject to a Software License Agreement found
 * in file LICENSE that is included with this distribution. 
 \*************************************************************************/
 /* iocInit.c	ioc initialization */ 
-/* base/src/db $Id: iocInit.c,v 1.11.2.4 2005/10/31 20:54:10 anj Exp $ */
+/* $Id: iocInit.c,v 1.11.2.5 2006/12/19 16:29:38 anj Exp $ */
 /*      Author:		Marty Kraimer   Date:	06-01-91 */
 
 
@@ -27,6 +26,7 @@
 #include "dbBase.h"
 #include "caeventmask.h"
 #include "dbAddr.h"
+#include "dbBkpt.h"
 #include "dbFldTypes.h"
 #include "link.h"
 #include "dbLock.h"
@@ -125,6 +125,7 @@
     interruptAccept=TRUE; initHooks(initHookAfterInterruptAccept);
     epicsThreadSleep(1.0);
 
+    dbBkptInit();
 
    /*  Start up CA server */
     rsrv_init();

References:
RE: Problems with database breakpoint routines. Rees, NP (Nick)

Navigate by Date:
Prev: RE: Problems with database breakpoint routines. Rees, NP (Nick)
Next: Re: EPICS on Tru64unix and HP-UX Kazuro FURUKAWA
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Problems with database breakpoint routines. Rees, NP (Nick)
Next: Re: EPICS on Tru64unix and HP-UX Andrew Johnson
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·