Need Help: Can only set gdb breakpoints in python module the first time

Ram Bhamidipaty ramb at synopsys.com
Mon Feb 25 13:46:13 EST 2002


I found that this same behavior happens with python without my application:

$ gdb /usr/local/bin/python
GNU gdb 5.0
...
This GDB was configured as "i386-redhat-linux"...
(gdb) break PyImport_GetMagicNumber
Breakpoint 1 at 0x8098263: file Python/import.c, line 374.
(gdb) run
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.exit(0)

Program exited normally.


(gdb) run
warning: Cannot insert breakpoint -7:
Cannot access memory at address 0x4002dd24
(gdb) q


In order to place more breakpoints I would need to exit gdb and restart
the whole gdb run.

-Ram





Ram Bhamidipaty <ramb at synopsys.com> writes:

> Python is embedded into my application. I have a custom module that
> is part of the application - it is not loaded as a shared library - rather
> the object files are incorporated into the final binary at link time.
> 
> The problem I am having is that I can set breakpoints in my module only
> when gdb is first started. Once my app exits I am no longer able to set
> breakpoints on functions in my module.
> 
> I suspect that python is somehow changing the mapping of the text segment,
> but that just a guess.
> 
> My question: What is python doing that prevents gdb from setting breakpoints
> after the program exits the first time? How can I prevent this?
> 
> 
> Thanks for any info.
> -Ram



More information about the Python-list mailing list