public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Reuben Thomas <rrt@sc3d.org>
To: gdb@sourceware.org
Subject: Adding Python files to be autoloaded for a particular architecture
Date: Fri, 17 Jul 2020 17:11:43 +0100	[thread overview]
Message-ID: <CAOnWdojq2PBG-VZ=2EONDqNs8zPzdj8Ju=tBkGo5ND6QjmLsRQ@mail.gmail.com> (raw)

I have implemented gdb/binutils support for a new architecture (more on
that if & when I get it into a state in which it might be mergeable), and I
would like to have some Python loaded by default, to cope with an unusual
feature of the architecture (it's a stack machine, and gdb doesn't seem to
support stacks directly, so I added some Python routines to print out and
modify the stack).

This seems to be a suitable candidate for SYSTEM_GDBINIT_FILES. But if I
simply add a file to `SYSTEM_GDBINIT_FILES` in
`gdb/data-directory/Makefile.in`, and then configure with

--with-system-gdbinit-dir=$pkgdatadir/system-gdbinit

then all of the files are installed (there are already two existing files,
`elinos.py` and `wrs-linux.py`) and loaded when gdb starts up. This causes
errors, as `wrs-linux.py` in particular expects to find an environment
variable which I have not set.

So I wonder how I should do this? Ideally, I would like to load a file when
gdb is configured for my new architecture, but I can't find a mechanism for
that. I tried running `make SYSTEM_GDBINIT_FILES="my_file.py", but this
environment variable does not get passed to make in `data-directory`, so
has no effect unless I specifically run `make` in that directory.

Apologies if I've overlooked something obvious. I have been impressed that
so far I have been able to add a new backend with gdb/ld/gas/bfd/opcodes
support with no documentation (well, I did cheat a bit, and referred to the
defunct Internals manual; but on the whole the code is fairly clearly laid
out, and simply picking an existing architecture and finding all references
to it provided enough guidance).

-- 
https://rrt.sc3d.org

             reply	other threads:[~2020-07-17 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17 16:11 Reuben Thomas [this message]
2020-07-17 21:42 ` Joel Brobecker
2020-07-17 22:03   ` Reuben Thomas
2020-07-17 22:09     ` Christian Biesinger
2020-07-17 22:21       ` Reuben Thomas
2020-07-17 22:31         ` Christian Biesinger
2020-07-17 22:37           ` Reuben Thomas
2020-07-20 20:26             ` Christian Biesinger
2020-07-20 21:39               ` Reuben Thomas
2020-07-17 22:14     ` Joel Brobecker
2020-07-17 22:18       ` Reuben Thomas

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='CAOnWdojq2PBG-VZ=2EONDqNs8zPzdj8Ju=tBkGo5ND6QjmLsRQ@mail.gmail.com' \
    --to=rrt@sc3d.org \
    --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).