Adding GDB initialization hook on RTEMS-specific GDB

Suraj Kumar via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CADrM=00szJR3=cyscnBvE1LwwEGUBZOewYPZGiY53Jnc06t_0Q@mail.gmail.com>
I am currently working on a project to extend the debugger present in any
RTEMS(https://www.rtems.org) installation, to add support for
pretty-printing C++ STL objects.

I would like some help to know how I can make GDB automatically load a
script upon being run, and when the file being loaded is a
static-executable.
For dynamic executables, I think the best approach is to place the script
in the "{prefix}/share/gdb/auto-load/" directory, and let GDB load it
automatically when the ELF resolves its functions dynamically (I think this
is also the current standard approach).

However, I noticed that this does not work for executables that are
statically-linked.

Is there any way to make GDB automatically load scripts upon being run, to
extend pretty-printing capabilities for GDB with static executables as well?

My current idea is adding the ".debug_gdb_scripts" section to the ELF, and
placing the path to the script which initialises the pretty-printer over
there, which is working well, but this introduces a new variable of needing
to track the path to the script (since it would change for each user,
depending on where their RTEMS installation is present).

Any help would be greatly appreciated.

Thanks,
Suraj Kumar
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.