From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18408 invoked by alias); 16 Oct 2014 13:45:56 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 18397 invoked by uid 89); 16 Oct 2014 13:45:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 16 Oct 2014 13:45:50 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9GDjkkJ020991 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Oct 2014 09:45:47 -0400 Received: from localhost.localdomain (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9GCrZAt010517; Thu, 16 Oct 2014 08:53:35 -0400 Message-ID: <543FBFCE.4030305@redhat.com> Date: Thu, 16 Oct 2014 13:45:00 -0000 From: Phil Muldoon MIME-Version: 1.0 To: =?UTF-8?B?w5ZtZXIgU2luYW4gQcSfYWNhbg==?= , gdb Subject: Re: GDB C API -- does such a thing exist? References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00036.txt.bz2 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