Force the delivery of a particular message in the queue
authorFilippo Gioachin <gioachin@uiuc.edu>
Tue, 25 May 2010 22:32:00 +0000 (17:32 -0500)
committerFilippo Gioachin <gioachin@uiuc.edu>
Tue, 25 May 2010 22:32:00 +0000 (17:32 -0500)
src/ck-core/debug-charm.C
src/ck-core/debug-charm.h

index 7302f1bd7813fe6374ab66e4913feaeda081b294..e7aa698f096ac71b91fa38da3f1d50da4c3d4486 100644 (file)
@@ -510,6 +510,28 @@ class CpdList_message : public CpdListAccessor {
   }
 };
 
+void CpdDeliverMessage(char * msg) {
+  int msgNum;
+  void *m;
+  sscanf(msg+CmiMsgHeaderSizeBytes, "%d", &msgNum);
+  //CmiPrintf("received deliver request %d\n",msgNum);
+
+  void *debugQ=CpvAccess(debugQueue);
+  CdsFifo_Enqueue(debugQ, (void*)(-1)); // Enqueue a guard
+  for (int i=0; i<msgNum; ++i) CdsFifo_Enqueue(debugQ, CdsFifo_Dequeue(debugQ));
+  CkpvAccess(skipBreakpoint) = 1;
+  char *queuedMsg = (char *)CdsFifo_Dequeue(debugQ);
+#if CMK_BLUEGENE_CHARM
+  stopVTimer();
+  BgProcessMessageDefault(cta(threadinfo), queuedMsg);
+  startVTimer();
+#else
+  CmiHandleMessage(queuedMsg);
+#endif
+  CkpvAccess(skipBreakpoint) = 0;
+  while ((m=CdsFifo_Dequeue(debugQ)) != (void*)(-1)) CdsFifo_Enqueue(debugQ, m);  
+}
+
 class CpdList_msgStack : public CpdListAccessor {
   virtual const char * getPath(void) const {return "charm/messageStack";}
   virtual size_t getLength(void) const {
@@ -832,6 +854,7 @@ void CpdCharmInit()
   CcsRegisterHandler("ccs_debug_startgdb",(CmiHandler)CpdStartGdb);
   CpdListRegister(new CpdListAccessor_c("hostinfo",hostInfoLength,0,hostInfo,0));
   CpdListRegister(new CpdList_localQ());
+  CcsRegisterHandler("deliverMessage",(CmiHandler)CpdDeliverMessage);
   CpdListRegister(new CpdList_arrayElementNames());
   CpdListRegister(new CpdList_arrayElements());
   CpdListRegister(new CpdList_objectNames());
index ee6f7b7db0085ea6d1424dfe68b9f7e3e235e04b..e2b2a29bde8e7ca5352694c1307835d5afbd78a2 100644 (file)
@@ -15,7 +15,7 @@
 #include "cklists.h"
 
 #define CHARMDEBUG_MAJOR   10
-#define CHARMDEBUG_MINOR    0
+#define CHARMDEBUG_MINOR    1
 
 void *CpdGetCurrentObject();
 void *CpdGetCurrentMsg();