Reputation: 179412
I'm adding some features I find useful to my GDB startup script. A few of the startup commands apply only to "live" targets, or have components that make sense only with live targets. I'd like to be able to test for the presence (or absence) of a core file, and skip or amend these commands as appropriate.
I looked around in the Python API, but couldn't find anything that tells me whether an inferior is a core file or a live program. I'm fine with a scripting solution that works in either GDB itself or in the Python GDB scripting interface.
Upvotes: 0
Views: 306
Reputation: 904
info proc status
returns "unable to handle request"
for core files, whereas for a live process it returns several lines, the first of which looks like: "process 1234"
.
You can run that command and compare its first output line against that string using the execute_output()
function from here: https://github.com/crossbowerbt/GDB-Python-Utils/blob/master/gdb_utils.py
Upvotes: 0
Reputation: 213496
It doesn't look like there is a way to do that.
I'd expect an attribute on gdb.Inferior
, but there isn't one.
File a feature request in GDB bugzilla.
Upvotes: 1