This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix python indented multi-line commands


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]