Fix python indented multi-line commands
Daniel Jacobowitz
drow@false.org
Wed Aug 13 12:41:00 GMT 2008
On Wed, Aug 13, 2008 at 03:40:03AM -0300, Thiago Jung Bauermann wrote:
> Hi,
>
> Today, if you try to use indentation in Python code within GDB you will
> get this error:
>
> (gdb) python
> >def foo ():
> > print 'hooray'
> >end
> File "<string>", line 2
> print 'hooray'
> ^
> IndentationError: expected an indented block
>
> The patch below, extracted from the python branch, fixes the problem.
> It changes GDB to not trim whitespace from the beginning of the line
> when storing multi-line commands internally. Tested with no regressions
> on x86_64-linux. Ok?
>
> :ADDPATCH cli:
:REVIEWMAIL:
This is OK. Could you add a second test for this bit?
> @@ -1386,7 +1404,7 @@ document_command (char *comname, int fro
> error (_("Command \"%s\" is built-in."), comname);
>
> sprintf (tmpbuf, "Type documentation for \"%s\".", comname);
> - doclines = read_command_lines (tmpbuf, from_tty);
> + doclines = read_command_lines (tmpbuf, from_tty, 0);
>
> if (c->doc)
> xfree (c->doc);
--
Daniel Jacobowitz
CodeSourcery
More information about the Gdb-patches
mailing list