Re: GDB C API -- does such a thing exist?
Phil Muldoon <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On 16/10/14 12:20, Ö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. No. Well let me qualify. There is a libgdb, but I have never used it and I am not sure anyone has for some many years. I am not sure how maintained it is either. Someone else might know more. A direct C API, aka what we have with Python, while nice, is not likely any time soon. We cannot just expose all of the innards of GDB automatically, say with some script, to a C API. GDB internals were never designed to be exposed in such a way. The API would have to be a curated API and I don't see anyone working on that goal at present. If you are determined to go the C route, IMO your best bet would be to modify GDB directly to your needs and rebuild. GDB is fairly trivial to build. Less so to modify, but those are your options at the moment. ;) As it is, for scripting with have Python and Guile based scripting. Cheers, Phil