home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / VB.C < prev    next >
Text File  |  1995-04-20  |  6KB  |  181 lines

  1. #include "all.h"
  2.  
  3. #define ENDOFCMDS 0
  4.  
  5. /*****************************************************************************/
  6. /* - verbose handling for commands sent to the probe.                     917*/
  7. /*****************************************************************************/
  8. typedef struct
  9. {
  10.  int   msgnum;
  11.  char *msg;
  12. }ESP_CMD;
  13.  
  14. static ESP_CMD  CmdMsg[] =
  15. {
  16.  FINDEXE               , "FindEexe"               ,
  17.  STARTUSER             , "StartUser"              ,
  18.  GOINIT                , "GoInit"                 ,
  19.  DEFBRK                , "DefBrk"                 ,
  20.  UNDBRK                , "UndBrk"                 ,
  21.  PUTINBRK              , "PutInBrk"               ,
  22.  PULLOUTBRK            , "PullOutBrk"             ,
  23.  INSERTALLBRK          , "InsertAllBrk"           ,
  24.  REMOVEALLBRK          , "RemoveAllBrk"           ,
  25.  DOSDEBUG              , "DosDebug"               ,
  26.  GETTHREADINFO         , "GetThreadInfo"          ,
  27.  FREEZETHREAD          , "FreezeThread"           ,
  28.  THAWTHREAD            , "ThawThread"             ,
  29.  GETCALLSTACK          , "GetCallStack"           ,
  30.  GOSTEP                , "GoStep"                 ,
  31.  GETEXEORDLLENTRY      , "GetExeOrDllEntry"       ,
  32.  NORMALQUIT            , "NormalQuit"             ,
  33.  SETEXECADDR           , "SetExecAddr"            ,
  34.  GOFAST                , "GoFast"                 ,
  35.  DEFWPS                , "DefWps"                 ,
  36.  PUTINWPS              , "PutInWps"               ,
  37.  PULLOUTWPS            , "PullOutWps"             ,
  38.  GETDATABYTES          , "GetDataBytes"           ,
  39.  GETMEMBLKS            , "GetMemBlks"             ,
  40.  SETXCPTNOTIFY         , "SetXcptNotify"          ,
  41.  SETEXECTHREAD         , "SetExecThread"          ,
  42.  WRITEREGS             , "WriteRegs"              ,
  43.  GETCOREGS             , "GetCoregs"              ,
  44.  TERMINATEESP          , "TerminateEsp"           ,
  45.  SETESPRUNOPTS         , "SetEspRunOpts"          ,
  46.  CTRL_BREAK            , "CtrlBreak"              ,
  47.  NEW_PROCESS           , "NewProcess"             ,
  48.  START_ESP_QUE         , "StartEspQue"            ,
  49.  START_QUE_LISTEN      , "StartQueListen"         ,
  50.  CONNECT_DBG           , "ConnectDbg"             ,
  51.  CONNECT_ESP           , "ConnectEsp"             ,
  52.  SERIAL_POLL           , "SerialPoll"             ,
  53.  CONNECT_NOTIFY        , "ConnectNotify"          ,
  54.  GOENTRY               , "GoEntry"                ,
  55.  KILL_LISTEN_THREAD    , "KillListenThread"       ,
  56.  SELECT_SESSION        , "SelectSession"          ,
  57.  ENDOFCMDS             , ""
  58. };
  59.  
  60. /*****************************************************************************/
  61. /* - print the command message.                                              */
  62. /*****************************************************************************/
  63. void PrintCmdMessage( int cmd )
  64. {
  65.  int              i;
  66.  ESP_CMD         *pmsg;
  67.  
  68.  for( i = 0 , pmsg = CmdMsg; pmsg[i].msgnum != ENDOFCMDS ; i++ )
  69.  {
  70.   if( ( cmd == pmsg[i].msgnum ) )
  71.   {
  72.    if( pmsg[i].msgnum == SERIAL_POLL )
  73.     printf("%c",'_');
  74.    else
  75.    {
  76.     char  fmt[10];
  77.     sprintf(fmt,"\n%c-%d%c", '%', strlen(pmsg[i].msg),'s' );
  78.     printf(fmt, pmsg[i].msg );
  79.    }
  80.    break;
  81.   }
  82.   fflush(0);
  83.  }
  84. }
  85.  
  86. #ifdef __ESP__
  87. /*---------------------------------------------------------------------------*/
  88. /*****************************************************************************/
  89. /* - verbose handling for the esp queue messages.                            */
  90. /*****************************************************************************/
  91. typedef struct
  92. {
  93.  int   msgnum;
  94.  char *msg;
  95. }ESPQ_MSG;
  96.  
  97.  
  98. static ESPQ_MSG  EspMsg[] =
  99. {
  100.  ESP_QMSG_END_SESSION    , "Esp_Qmsg_End_Session"    ,
  101.  ESP_QMSG_NEW_SESSION    , "Esp_Qmsg_New_Session"    ,
  102.  ESP_QMSG_CTRL_BREAK     , "Esp_Qmsg_Ctrl_Break"     ,
  103.  ESP_QMSG_DISCONNECT     , "Esp_Qmsg_Disconnect"     ,
  104.  ESP_QMSG_CONNECT_REQUEST, "Esp_Qmsg_Connect_Request",
  105.  ESP_QMSG_QUE_TERM       , "Esp_Qmsg_Que_Term"       ,
  106.  ESP_QMSG_ERROR          , "Esp_Qmsg_Error"          ,
  107.  ESP_QMSG_EMPTY          , "Esp_Qmsg_Empty"          ,
  108.  ESP_QMSG_NEW_PROCESS    , "Esp_Qmsg_New_Process"    ,
  109.  ESP_QMSG_OPEN_CONNECT   , "Esp_Qmsg_OpenConnect"    ,
  110.  ESP_QMSG_SELECT_SESSION , "Esp_Qmsg_Select_Session" ,
  111.  ESP_QMSG_SELECT_ESP     , "Esp_Qmsg_Select_Esp"     ,
  112.  ESP_QMSG_PARENT_TERM    , "Esp_Qmsg_Parent_Term"    ,
  113.  ESP_QMSG_CHILD_TERM     , "Esp_Qmsg_Child_Term"     ,
  114.   -1 , ""
  115. };
  116.  
  117. void PrintQueMessage( void *p,void *q)
  118. {
  119.  PREQUESTDATA     pqr = (PREQUESTDATA)p;
  120.  int              i;
  121.  ESPQ_MSG          *pmsg;
  122.  
  123.  for( i = 0 , pmsg = EspMsg; pmsg[i].msgnum != -1 ; i++ )
  124.  {
  125.   if( (pqr->ulData == pmsg[i].msgnum ) )
  126.   {
  127.    printf("\n%-21s",  pmsg[i].msg );fflush(0);
  128.    break;
  129.   }
  130.  }
  131. }
  132. /*---------------------------------------------------------------------------*/
  133. #endif
  134.  
  135. #ifdef __DBG__
  136. /*---------------------------------------------------------------------------*/
  137. /*****************************************************************************/
  138. /* - verbose handling for the dbg queue messages.                            */
  139. /*****************************************************************************/
  140. typedef struct
  141. {
  142.  int   msgnum;
  143.  char *msg;
  144. }DBGQ_MSG;
  145.  
  146.  
  147. static DBGQ_MSG  DbgMsg[] =
  148. {
  149.  DBG_QMSG_CTRL_BREAK        , "DbgQmsgCtrlBreak"       ,
  150.  DBG_QMSG_OPEN_CONNECT      , "DbgQmsgOpenConnect"     ,
  151.  DBG_QMSG_QUE_TERM          , "DbgQmsgQueTerm"         ,
  152.  DBG_QMSG_NEW_PROCESS       , "DbgQmsgNewProcess"      ,
  153.  DBG_QMSG_DISCONNECT        , "DbgQmsgDisConnect"      ,
  154.  DBG_QMSG_CONNECT_ESP       , "DbgQmsgConnectEsp"      ,
  155.  DBG_QMSG_SELECT_SESSION    , "DbgQmsgSelectSession"   ,
  156.  DBG_QMSG_ERROR             , "DbgQmsgError"           ,
  157.  DBG_QMSG_KILL_LISTEN       , "DbgQmsgKillListen"      ,
  158.  DBG_QMSG_PARENT_TERM       , "DbgQmsgParentTerm"      ,
  159.  DBG_QMSG_CHILD_TERM        , "DbgQmsgChildTerm"       ,
  160.  DBG_QMSG_SELECT_PARENT_ESP , "DbgQmsgSelectParentEsp" ,
  161.   -1 , ""
  162. };
  163.  
  164. void PrintDbgQueMessage( void *p)
  165. {
  166.  PREQUESTDATA     pqr = (PREQUESTDATA)p;
  167.  int              i;
  168.  DBGQ_MSG          *pmsg;
  169.  
  170.  for( i = 0 , pmsg = DbgMsg; pmsg[i].msgnum != -1 ; i++ )
  171.  {
  172.   if( (pqr->ulData == pmsg[i].msgnum ) )
  173.   {
  174.    printf("\n%-21s",  pmsg[i].msg );fflush(0);
  175.    break;
  176.   }
  177.  }
  178. }
  179. /*---------------------------------------------------------------------------*/
  180. #endif
  181.