From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Florian Weimer <fweimer@redhat.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Subject: RE: Using GDB as a Python interpreter
Date: Mon, 3 Jul 2023 07:11:47 +0000 [thread overview]
Message-ID: <DM4PR11MB7303D5468357169E45FDC69AC429A@DM4PR11MB7303.namprd11.prod.outlook.com> (raw)
In-Reply-To: <87sfa8vwqx.fsf@oldenburg.str.redhat.com>
On Saturday, July 1, 2023 10:53 AM, Florian Weimer wrote:
> I want to run a Python script with GDB, from the shell command line,
> without having to create two files.
>
> I came up with the hack included below, but it's not particularly nice.
> The downside is that the script file name must end in “.py”, which would
> not allow to install the script in /usr/bin for most distributions. I
> don't see a way to override that.
Based on this comment, I assume you have write access to /usr.
Would you then consider wrapping your script in a Python function
and then installing it in GDB's data directory
(e.g. /usr/share/gdb/python/gdb/function/)? The file would be loaded
automatically by GDB at startup. You can then invoke the Python function
with a single-line GDB command.
-Baris
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2023-07-03 7:12 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 [this message]
2023-07-03 8:13 ` Florian Weimer
2023-07-03 19:39 ` Tom Tromey
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=DM4PR11MB7303D5468357169E45FDC69AC429A@DM4PR11MB7303.namprd11.prod.outlook.com \
--to=tankut.baris.aktemur@intel.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).