public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/1] Integrate GNU poke in GDB
Date: Mon, 10 May 2021 17:10:43 +0200	[thread overview]
Message-ID: <20210510151044.20829-1-jose.marchesi@oracle.com> (raw)

Hi GDB people!

The patch below integrates GNU poke (http://jemarch.net/poke) in
GDB by mean of libpoke.

It allows the GDB user to execute Poke code from within the
debugger with access to the target memory, types and values.

A few notes:

- The poke support is optional, and built if specified with
  --enable-poke at configure time.

- The poke support requires libpoke from git master (which will
  become poke 2.x in a few months) since it uses some interfaces
  that are not available in the released poke 1.x series.

- Sorry for what is probably an atrocious mixture of C and C++
  idioms.  I avoid C++ like the pest, but I am all willing to try
  and write proper C++ for this integration.

- Eventually we will probably want to ship some prewritten Poke
  code in a pickle gdb.pk.  Would $pkddatadir/poke/ be a good
  location for Poke code distributed with GDB?

And a few questions:

- Where am I supposed to cleanup and shut down the incremental
  compiler when GDB exits?  I looked but I cannot find a
  counterpart to _initialize_FOO, like _finalize_FOO.

- There are many global parameters that can be configured in the
  poke incremental compiler: the numeration base used when
  printing values, the global endianness, a cut-off value for how
  many array elements are printed, and the like.  Reasonable
  defaults for them are set in `start_poke', but I would like the
  GDB user to be able to change these settings.  I could add a
  `poke-set SETTING [VALUE]' command, but I was wondering whether
  there is a better way, like a global register of settings
  already in GDB?

- I am using target_{read,write}_raw_memory to access the
  target's memory.  What is the difference between the raw and
  non-raw accessors?

- How can I demangle C++ identifiers?  And how can I detect when
  a given type is a C++ one that needs demangling?

How this stuff works:

- GDB links with libpoke.so and uses the interface in libpoke.h.
  This is also how the GNU poke application (the command-line
  editor) is implemented.

- There are three commands:

  poke STR
  poke-add-type EXPR
  poke-add-types REGEXP
  poke-dump-types

  All three commands make sure to start the poke incremental
  compiler if it isn't running already.

- Access to the target's memory is provided by GDB by installing
  a Foreign IO device in the incremental compiler.  This is
  `iod_if' in poke.c.

- Access to the terminal is provided by GDB by providing a
  pk_term_if implementation to the incremental compiler.  This is
  `poke_term_if' in poke.c.

- Access to GDB values is provided by GDB by installing an alien
  token handler in the incremental compiler.  This is
  `poke_alien_token_handler' in poke.c.

Jose E. Marchesi (1):
  Integrate GNU poke in GDB

 gdb/ChangeLog       |   8 +
 gdb/Makefile.in     |   6 +-
 gdb/configure       |  89 +++++-
 gdb/configure.ac    |  15 +
 gdb/doc/ChangeLog   |   6 +
 gdb/doc/Makefile.in |   1 +
 gdb/doc/gdb.texinfo |   4 +
 gdb/doc/poke.texi   | 373 ++++++++++++++++++++++
 gdb/poke.c          | 762 ++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 1257 insertions(+), 7 deletions(-)
 create mode 100644 gdb/doc/poke.texi
 create mode 100644 gdb/poke.c

-- 
2.25.0.2.g232378479e


             reply	other threads:[~2021-05-10 15:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 15:10 Jose E. Marchesi [this message]
2021-05-10 15:10 ` [PATCH 1/1] " Jose E. Marchesi
2021-05-10 16:56   ` Eli Zaretskii
2021-05-10 18:49     ` Jose E. Marchesi
2021-05-10 18:52       ` Eli Zaretskii
2021-05-11  7:33   ` Andrew Burgess
2021-05-11 13:07     ` Jose E. Marchesi
2021-05-12  8:52       ` Andrew Burgess
2021-05-12 10:14         ` Jose E. Marchesi
2021-05-13 16:59   ` Tom Tromey
2021-05-10 18:39 ` [PATCH 0/1] " Simon Marchi
2021-05-10 20:07   ` Jose E. Marchesi
2021-05-11  6:25     ` Andrew Burgess
2021-05-13 17:04   ` Tom Tromey
2021-05-11 18:56 ` Tom Tromey
2021-05-12  8:06   ` Jose E. Marchesi
2021-05-13 15:52     ` Tom Tromey
2021-05-14 20:52       ` Jose E. Marchesi

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=20210510151044.20829-1-jose.marchesi@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=gdb-patches@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).