public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Florian Weimer via Gdb <gdb@sourceware.org>
Cc: Florian Weimer <fweimer@redhat.com>
Subject: Re: Using GDB as a Python interpreter
Date: Mon, 03 Jul 2023 13:39:34 -0600	[thread overview]
Message-ID: <87zg4cvl6x.fsf@tromey.com> (raw)
In-Reply-To: <87sfa8vwqx.fsf@oldenburg.str.redhat.com> (Florian Weimer via Gdb's message of "Sat, 01 Jul 2023 10:53:10 +0200")

>>>>> "Florian" == Florian Weimer via Gdb <gdb@sourceware.org> 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

  parent reply	other threads:[~2023-07-03 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-01  8:53 Florian Weimer
2023-07-03  7:11 ` Aktemur, Tankut Baris
2023-07-03  8:13   ` Florian Weimer
2023-07-03 19:39 ` Tom Tromey [this message]
2023-07-03 20:24   ` Mark Wielaard
2023-07-03 23:00     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg4cvl6x.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=fweimer@redhat.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).