public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Bob Rossi <bob@brasko.net>
To: "Ömer Sinan Ağacan" <omeragacan@gmail.com>
Cc: gdb <gdb@sourceware.org>
Subject: Re: GDB C API -- does such a thing exist?
Date: Thu, 16 Oct 2014 14:01:00 -0000	[thread overview]
Message-ID: <20141016140154.GA11459@linux> (raw)
In-Reply-To: <CAMQQO3=gR_6=D__Q_rn2Q8LQmE+bdokhAmbKh6fEkkNMH42fxA@mail.gmail.com>

On Thu, Oct 16, 2014 at 02:20:25PM +0300, Ömer Sinan Ağacan wrote:
> Do we have a C API for GDB? Something that allows me to run all the
> GDB commands/functions that I can run in GDB prompt, but without
> messing with GDB prompt?
> 
> Python API is not great for what I want to do. I want to run GDB
> inside a program, search for some specific currently-running
> processes, attach to them, add some breakpoints etc. although all of
> those are possible with Python API, 1) I'm not huge fan of the
> language 2) I feel like most things would be a lot easier if I could
> use a C API that allows me to drive GDB itself.

There is not. Your options are to use the GDB/MI interface or use the
python api.

If you want to use the GDB/MI interface, congratulations, you have to
read and interpret the spec, find all the bugs in it, write a parser
to support all the cases and test it against old and new versions of
GDB. It's a daunting task, I know, I'm working on it.
  https://github.com/brasko/gdbwire
I don't expect to be done implementing and testing this for a long time.

If you want to use the GDB python interface you need to understand that
many GDB deployments do not have the python interpreter built into them.
Also, I'm not sure anyone has successfully tried to control GDB through
the python interface while allowing the user to use the cli interface.
Not sure if this is your goal.

Both of these approaches are possible, but not for the faint of heart.

Good luck!
Bob Rossi

  parent reply	other threads:[~2014-10-16 14:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 11:21 Ömer Sinan Ağacan
2014-10-16 13:45 ` Phil Muldoon
2014-10-16 13:54   ` Joel Brobecker
2014-10-16 14:06     ` Jan Kratochvil
2014-10-28 12:58   ` Jonas Maebe
2014-10-16 14:01 ` Bob Rossi [this message]
2014-10-16 14:09   ` Jan Kratochvil
2014-10-16 23:45 ` Stan Shebs
2014-10-17  6:45   ` Ömer Sinan Ağacan
2014-10-17  8:08     ` Pedro Alves
2014-10-17  8:47       ` Pedro Alves
2014-10-28 13:30         ` Jonas Maebe
2014-10-30 10:09           ` Pedro Alves
2014-10-17 12:06     ` Jan Kratochvil
2014-10-17 12:29       ` Joel Brobecker
2014-10-17 15:32         ` Bob Rossi
2014-10-17 12:02   ` Jan Kratochvil
2014-10-17 12:17   ` Jan Kratochvil

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=20141016140154.GA11459@linux \
    --to=bob@brasko.net \
    --cc=gdb@sourceware.org \
    --cc=omeragacan@gmail.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).