Re: Using GDB as a Python interpreter

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
>>>>> "Florian" == Florian Weimer via Gdb <[email protected]> writes:

Florian> I want to run a Python script with GDB, from the shell command line,
Florian> without having to create two files.

Once upon a time, Red Hat had a patch to add a '-P' option to gdb, which
would put it directly into Python scripting.  I think maybe I wrote it
ages ago, but then when Andrew tried to submit it upstream, I basically
rejected it.

That was a mistake on my part.  IIRC he had a pretty good
counter-argument at the time, I don't recall why I didn't recant.

Another option I looked at, way back when, was to compile gdb with -fPIE
and let it be loaded as a shared library.  The idea here was that, with
a few other tweaks, ordinary Python code could just 'import gdb'.

Anyway, I guess now I'd support either of these.  'import gdb' would be
great to have, even with its various limitations.  However it's a bit
trickier to get working than just resurrecting the old -P patch.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.