This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: GDB C API -- does such a thing exist?
- From: Stan Shebs <stanshebs at earthlink dot net>
- To: gdb at sourceware dot org
- Date: Thu, 16 Oct 2014 16:45:17 -0700
- Subject: Re: GDB C API -- does such a thing exist?
- Authentication-results: sourceware.org; auth=none
- References: <CAMQQO3=gR_6=D__Q_rn2Q8LQmE+bdokhAmbKh6fEkkNMH42fxA at mail dot gmail dot com>
On 10/16/14, 4:20 AM, Ã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.
The fact of the situation is that a C API would make things harder, not
easier. Consider that GDB is a) making system calls, which are
sometimes blocking, b) is doing tricks with signals all over the place,
and c) gets involved with permissions, and d) manages vast quantities
of memory. It's just not something you ever want in your address space,
like having a drunken malpracticing doctor wandering around your hotel
with a master key and a bagful of scary medical instruments. :-)
MI is really the safe way to go.
Stan
stan@codesourcery.com