This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB C API -- does such a thing exist?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]