I'm starting to work on pdb for fixing bugs, segfaults and so, and maybe
implement new commands listed in TODO.

I noticed that command arguments does not support spacing between command
and argument. I have written a small patch that uses nextarg() for getting
command arguments. This means that now works things like:

 (pdb) next 3
 (pdb) next   4

but will not run the old-fashion commands:

  (pdb) next3

imho the 'old' syntax is ugly, and we should relay on the new one checking for
spaces properly.

feel free to submit this patch if looks ok for you.

Thanks

  --pancake
Index: src/debug.c
===================================================================
--- src/debug.c	(revision 19192)
+++ src/debug.c	(working copy)
@@ -460,6 +460,8 @@
     if (!(pdb->state & PDB_RUNNING))
         PDB_init(interp, command);
 
+    command = nextarg(command);
     /* Get the number of operations to execute if any */
     if (command && isdigit((int) *command))
         n = atol(command);
@@ -505,6 +507,7 @@
     if (!(pdb->state & PDB_RUNNING))
         PDB_init(interp, command);
 
+    command = nextarg(command);
     /* if the number of ops to run is specified, convert to a long */
     if (command && isdigit((int) *command))
         n = atol(command);
@@ -772,6 +775,7 @@
     PDB_line_t       *line;
     long              ln, i;
 
+    command = nextarg(command);
     /* If no line number was specified, set it at the current line */
     if (command && *command) {
         ln = atol(command);
@@ -909,6 +913,7 @@
             return;
         }
 
+    	command = nextarg(command);
         ln = atol(command);
         PDB_skip_breakpoint(interp, ln);
     }
@@ -936,6 +941,7 @@
     PDB_breakpoint_t *breakpoint;
     long              n;
 
+    command = nextarg(command);
     if (isdigit((int) *command)) {
         n          = atol(command);
         breakpoint = interp->pdb->breakpoint;
@@ -1971,6 +1977,7 @@
         return;
     }
 
+    command = nextarg(command);
     /* set the list line if provided */
     if (isdigit((int) *command)) {
         line_number = atol(command) - 1;
@@ -2157,6 +2164,7 @@
     long           depth = 0;
     Stack_Chunk_t *chunk = CONTEXT(interp->ctx)->user_stack;
 
+    command = nextarg(command);
     if (*command)
         depth = atol(command);
 

Reply via email to