This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fix python indented multi-line commands
- From: Daniel Jacobowitz <drow at false dot org>
- To: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 13 Aug 2008 08:41:17 -0400
- Subject: Re: Fix python indented multi-line commands
- References: <g7tvk3$lck$1@ger.gmane.org>
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