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: Make the "python" command resemble the standard Python interpreter


On Mon, Jan 30, 2012 at 9:18 AM, Doug Evans <dje@google.com> wrote:
> Plus, with some playing around I found this:
>
> --- foo.gdb - snip ---
> python
> if 0 == 1:
> ?print "foo"
> print "bar"
> end
> --- snip ---
>
> (gdb) source foo.gdb
> bar
> (gdb)
>
> But cut-n-paste that script into gdb and I get this:
>
> (gdb) python
> if 0 == 1:
> ?print "foo"
> print "bar"
> end
>>>> ... ... ? File "<stdin>", line 3
> ? ?print "bar"
> ? ? ? ?^
> SyntaxError: invalid syntax
>>>>
> (gdb)
>
> [For reference sake, here's how I cut-n-pasted it in emacs:
> C-x C-f foo.gdb RET C-space C-x ] C-b M-w C-x b RET C-y RET
> I hope I transcribed that right.]
>
> Python's repl expects a blank line to end the block.
> I don't know if there's a way to work around this. ?Maybe there is.
> So now I'm even less comfortable.

btw, that's with the latest python-interactive script (that I could
find) applied (+ the sigint patch too).

For grin's sake, there's another example:

--- snip ---
python
if 0 == 1:
  print "foo"
end
---

If I cut-n-paste that into gdb the "end" terminates the "if" block
(heh, didn't expect that :-)), and afterwards I'm still in python.
Maybe this can be fixed too.


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