00001 /* 00002 Interface to Charm++ portion of parallel debugger. 00003 Orion Sky Lawlor, olawlor@acm.org, 7/30/2001 00004 */ 00005 #ifndef __CMK_DEBUG_CHARM_H 00006 #define __CMK_DEBUG_CHARM_H 00007 00008 #ifndef __cplusplus 00009 # error "debug-charm.h is for C++; use debug-conv.h for C programs" 00010 #endif 00011 00012 #include "converse.h" 00013 #include "debug-conv++.h" 00014 #include "pup.h" 00015 #include "cklists.h" 00016 #include <vector> 00017 00018 void CkPupMessage(PUP::er &p,void **atMsg,int pack_detail=1); 00019 00020 void *CpdGetCurrentObject(); 00021 void *CpdGetCurrentMsg(); 00022 00023 //Hooks inside the debugger before and after an entry method is invoked 00024 extern void CpdBeforeEp(int, void*, void*); 00025 extern void CpdAfterEp(int); 00026 extern void CpdFinishInitialization(); 00027 00028 class CpdPersistentChecker { 00029 public: 00030 virtual ~CpdPersistentChecker() {} 00031 virtual void cpdCheck(void*) {} 00032 }; 00033 00034 typedef struct DebugPersistentCheck { 00035 CpdPersistentChecker *object; 00036 void *msg; 00037 00038 DebugPersistentCheck() : object(NULL), msg(NULL) {} 00039 DebugPersistentCheck(CpdPersistentChecker *o, void *m) : object(o), msg(m) {} 00040 } DebugPersistentCheck; 00041 00042 // This class is the parallel of EntryInfo declared in register.h and is used 00043 // to extend the former with additional debug information. There is a direct 00044 // correspondence between elements on the two arrays. 00045 class DebugEntryInfo { 00046 public: 00047 // true if this entry method has a breakpoint set 00048 bool isBreakpoint; 00049 std::vector<DebugPersistentCheck> preProcess; 00050 std::vector<DebugPersistentCheck> postProcess; 00051 00052 DebugEntryInfo() : isBreakpoint(false) { } 00053 }; 00054 00055 typedef std::vector<DebugEntryInfo> DebugEntryTable; 00056 00057 //These pup functions are useful in CpdLists, as they document the name 00058 // of the variable. Your object must be named "c" (a stupid hack). 00059 #define PCOM(field) p.comment(#field); p(c->field); 00060 #define PCOMS(field) \ 00061 if (!p.isUnpacking()) { \ 00062 p.comment(#field); p((char *)c->field,strlen(c->field)); \ 00063 } 00064 00065 #endif