[Python-Dev] What's the best way to debug python3 source code? (for this bug: http://bugs.python.org/issue15068)

Terry Reedy tjreedy at udel.edu
Mon Jun 18 18:49:02 CEST 2012


On 6/18/2012 7:10 AM, gmspro wrote:

> I'm working on this bug, http://bugs.python.org/issue15068

Oh. From your first message, I thought you were asking about a personal 
bug. I will mention that real names are customary on this list. (Unless 
you have a good professional reason otherwise.) They are also necessary 
for contributor forms, which we need from anyone submitting an 
acceptable patch large enough to be covered by copyright.

> I tried this with gdb
> (gdb)run
>  >>>from sys import stdin
>  >>>str=sys.stdin.read()
> blabla
> blabla
> blabla
> CTRL+D
> CTRL+D
>  >>>CTRL+C
> (gdb)backtrace

The backtrace is from when you hit ^C after the prompt and should have 
nothing to do with the double ^D behavior, except that it shows what we 
would like to the state after the first ^D.

> 0xb7f08348 in ___newselect_nocancel () at
> ../sysdeps/unix/syscall-template.S:82
> 82    ../sysdeps/unix/syscall-template.S: No such file or directory.
>      in ../sysdeps/unix/syscall-template.S
> Current language:  auto
> The current source language is "auto; currently asm".

It appears you interrupted in a system call written in assembler.

> (gdb) backtrace
> #0  0xb7f08348 in ___newselect_nocancel () at
> ../sysdeps/unix/syscall-template.S:82
> #1  0xb7b43f9f in readline_until_enter_or_signal (prompt=0xb7b578d0 ">>>
> ", signal=0xbfffed54)
>      at /home/user1/python/Python-3.2.3/Modules/readline.c:987

As far as Python goes, you were at line 987 of readline.c in 
readline_until_enter_or_signal(prompt, signal) where prompt was ">>>".

I would try again twice, hitting ^C once before and once after the first 
^D. This should tell you where Python and the system is when it receives 
^D and should return to the prompt (as in the backtrace you got) and 
where Python went instead after receiving ^D and where it is when it 
gets the second ^D and does return.

-- 
Terry Jan Reedy





More information about the Python-Dev mailing list