From: Florian Weimer <fweimer@redhat.com>
To: "Aktemur, Tankut Baris via Gdb" <gdb@sourceware.org>
Cc: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
Subject: Re: Using GDB as a Python interpreter
Date: Mon, 03 Jul 2023 10:13:42 +0200 [thread overview]
Message-ID: <87jzvh2z0p.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <DM4PR11MB7303D5468357169E45FDC69AC429A@DM4PR11MB7303.namprd11.prod.outlook.com> (Tankut Baris via Gdb Aktemur's message of "Mon, 3 Jul 2023 07:11:47 +0000")
* Tankut Baris via Gdb Aktemur:
> 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.
I was aiming for a one-file solution (and something that could be
installed as-is into /usr/bin eventually). Two-file solutions are sort
of easy. 8-)
Thanks,
Florian
next prev parent reply other threads:[~2023-07-03 8:13 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 [this message]
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=87jzvh2z0p.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=gdb@sourceware.org \
--cc=tankut.baris.aktemur@intel.com \
/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).