Martins changes
[fw/sdcc] / debugger / mcs51 / cmd.c
index 626994c6537ae9a86cb43af2f140fcf0ef2b5192..0c584c20068b2efa2ce5ec767e8fca61901eddff 100644 (file)
@@ -1301,6 +1301,40 @@ int cmdContinue (char *s, context *cctxt)
     return 0;
 }
 
+/*-----------------------------------------------------------------*/
+/* cmdCommands - set commands for breakpoint                       */
+/*-----------------------------------------------------------------*/
+int cmdCommands (char *s, context *cctxt)
+{   
+    int bpnum ;
+    char *cmds,*line;
+    while (isspace(*s)) s++;
+    
+    if (!*s ) 
+        bpnum = getLastBreakptNumber();
+    else
+        bpnum = strtol(s,0,10);
+
+    cmds = NULL;
+    while ((line = getNextCmdLine()))
+    {
+        while (isspace(*line)) line++;
+        if (!strncmp(line,"end",3))
+            break;
+        if (! cmds )
+        {
+            cmds = Safe_strdup(line);
+        }
+        else
+        {
+            cmds = Safe_realloc( cmds, strlen(cmds) + 1 + strlen(line));
+            strcat(cmds,line);
+        }
+    }
+    setUserbpCommand(bpnum,cmds);
+    return 0;
+}
+
 /*-----------------------------------------------------------------*/
 /* cmdDelUserBp - delete user break point                          */
 /*-----------------------------------------------------------------*/
@@ -3016,7 +3050,6 @@ int cmdClrUserBp (char *s, context *cctxt)
     return 0;        
 }
 
-
 /*-----------------------------------------------------------------*/
 /* cmdSimulator - send command to simulator                        */
 /*-----------------------------------------------------------------*/