addapt new syntax of s51
[fw/sdcc] / debugger / mcs51 / sdcdb.c
index d5c7a44becc444fd2b7f0f6ce7ff4849d7a64af8..1cc14082404448aece81fd3514c134efe379ed36 100644 (file)
@@ -89,8 +89,14 @@ struct cmdtab
     { "continue" ,  cmdContinue   ,
       "{c}ontinue\t\t Continue program being debugged, after breakpoint.\n"
     },
+    { "condition" ,  cmdCondition   ,
+      "condition brkpoint_number expr\t\tSet condition for breakpoint.\n"
+    },
+    { "ignore" ,  cmdIgnore  ,
+      "brkpoint_number count\t\tSet ignore count for breakpoint.\n"
+    },
     { "commands" ,  cmdCommands  ,
-      "commands [brkpoint number]\t\tSetting commands for breakpoint.\n"
+      "commands [brkpoint_number]\t\tSetting commands for breakpoint.\n"
     },
     { "c"        ,  cmdContinue   , NULL },
 
@@ -836,16 +842,23 @@ int interpretCmd (char *s)
 
 static FILE *actualcmdfile=NULL ;
 static char *actualcmds=NULL;
-
+static int   stopcmdlist;
 /*-----------------------------------------------------------------*/
 /* getNextCmdLine get additional lines used by special commands    */
 /*-----------------------------------------------------------------*/
 char *getNextCmdLine()
 {
+    //fprintf(stderr,"getNextCmdLine() actualcmdfile=%p\n",actualcmdfile);
     if (!actualcmdfile)
         return NULL;
+    fprintf(stdout,">");
+    fflush(stdout);
     if (fgets(cmdbuff,sizeof(cmdbuff),actualcmdfile) == NULL)
+    {
+        // fprintf(stderr,"getNextCmdLine() returns null\n");
         return NULL;
+    }
+    //fprintf(stderr,"getNextCmdLine() returns: %s",cmdbuff);
     return cmdbuff;
 }
 
@@ -854,6 +867,11 @@ void setCmdLine( char *cmds )
     actualcmds = cmds;
 }
 
+void stopCommandList()
+{
+    stopcmdlist = 1;
+}
+
 /*-----------------------------------------------------------------*/
 /* commandLoop - the main command loop or loop over command file   */
 /*-----------------------------------------------------------------*/
@@ -872,6 +890,8 @@ static void commandLoop(FILE *cmdfile)
             fflush(stdout);
         }
 
+        //fprintf(stderr,"commandLoop actualcmdfile=%p cmdfile=%p\n",
+        //        actualcmdfile,cmdfile);
         if (fgets(cmdbuff,sizeof(cmdbuff),cmdfile) == NULL)
             break;
 
@@ -882,6 +902,7 @@ static void commandLoop(FILE *cmdfile)
         {
             strcpy(cmdbuff,actualcmds);
             actualcmds = NULL;
+            stopcmdlist= 0;
             for ( line = cmdbuff; *line ; line = s )
             {
                 if ( (s=strchr(line ,'\n')))
@@ -900,6 +921,8 @@ static void commandLoop(FILE *cmdfile)
                     break;
                 }
                 *s = save_ch;
+                if ( stopcmdlist )
+                    break;
             }
         }
     }
@@ -1029,6 +1052,13 @@ static void parseCmdLine (int argc, char **argv)
         continue ;
       }
 
+      /* network serial port */
+      if ( (strcmp(argv[i],"-k") == 0)) {
+        simArgs[nsimArgs++] = strdup(argv[i]);
+        simArgs[nsimArgs++] = strdup(argv[++i]);
+        continue ;
+      }
+
       fprintf(stderr,"unknown option %s --- ignored\n",
         argv[i]);
 
@@ -1083,7 +1113,8 @@ static void sigchld(int sig)
 static void
 setsignals()
 {
-    signal(SIGHUP , bad_signal);               
+    signal(SIGHUP , SIG_IGN);          
+    signal(SIGCONT, SIG_IGN);          
     signal(SIGINT , sigintr ); 
     signal(SIGTERM, bad_signal);       
     signal(SIGCHLD, sigchld );