Bug 18335 - GDB Abort on "info program" in Python callback
Summary: GDB Abort on "info program" in Python callback
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: 7.9
: P2 normal
Target Milestone: 14.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-26 21:50 UTC by Zach Riggle
Modified: 2023-12-15 20:50 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zach Riggle 2015-04-26 21:50:49 UTC
The following script causes gdb 7.9-1ubuntu1 (Vivid) to abort.

```
python def function(*a): gdb.execute('info program', to_string=True, from_tty=False)
python gdb.events.new_objfile.connect(function)
run
```
Comment 1 Hannes Domani 2023-12-15 20:50:40 UTC
I can reproduce this abort in older gdb version, but from gdb-8.3.0 forward I see these errors instead:
```
Reading symbols from gdb-13380.exe...
(gdb) python def function(*a): gdb.execute('info program', to_string=True, from_tty=False)
(gdb) python gdb.events.new_objfile.connect(function)
(gdb) run
Starting program: C:\src\tests\gdb-13380.exe
Python Exception <class 'gdb.error'> No selected thread.:
Python Exception <class 'gdb.error'> No selected thread.:
Python Exception <class 'gdb.error'> No selected thread.:
Python Exception <class 'gdb.error'> No selected thread.:
Python Exception <class 'gdb.error'> No selected thread.:
[Inferior 1 (process 6096) exited normally]
```

And since the recently released gdb-14.1 all problems appear to be gone:
```
Reading symbols from gdb-13380.exe...
(gdb) python def function(*a): gdb.execute('info program', to_string=True, from_tty=False)
(gdb) python gdb.events.new_objfile.connect(function)
(gdb) run
Starting program: C:\src\tests\gdb-13380.exe
[Inferior 1 (process 10288) exited normally]
```

So I'm going to close this.