From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17230 invoked by alias); 16 Oct 2014 14:01:30 -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 17168 invoked by uid 89); 16 Oct 2014 14:01:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-pd0-f182.google.com Received: from mail-pd0-f182.google.com (HELO mail-pd0-f182.google.com) (209.85.192.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 16 Oct 2014 14:01:28 +0000 Received: by mail-pd0-f182.google.com with SMTP id y10so3319336pdj.13 for ; Thu, 16 Oct 2014 07:01:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=lLpBzd5JL6GVhO4ks45Nu/trnIGNBodIw37oJXBIEBk=; b=BagX+VrtPTmCwhtIryZuyKfpJ/e4CKnQ1z2LXe8qkJg6aHnjilm4v+hXCElHlrr6sf EflEuYlg+oKwa9f00l15AJ6sTPYE8d2Cren6ISQd4nzq9wQwK+MPf9L9mnTSZm0DmLBu 40mfohFFKGBi7icEpfmHboTSA5wIzHhkRt2rr2P/pd8VfuBlM+xPTsH3edcvS22MUEG5 c0KqTVHAdEdgtS4Bbii7PA5/BqnsX/giT63clbLB5ANRyDiSh7GPjaNxsna/YoaQfyZ7 j3jmAg6H4SgRzkO61tSPP0POJimsmzY6qE6GzoHJ98MRxpat8JEKHACyIhrl5Yg5iViq JrWQ== X-Gm-Message-State: ALoCoQlwkx6ivsXj9M8B/InvcRU+X//O8bKo1YNTFzD0jbOSCsGkMDU+PAMpsmo+93BE4MG8O32D X-Received: by 10.70.96.4 with SMTP id do4mr1417120pdb.133.1413468085285; Thu, 16 Oct 2014 07:01:25 -0700 (PDT) Received: from linux (ip68-9-64-242.ri.ri.cox.net. [68.9.64.242]) by mx.google.com with ESMTPSA id ll4sm20058029pab.25.2014.10.16.07.01.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Oct 2014 07:01:24 -0700 (PDT) Date: Thu, 16 Oct 2014 14:01:00 -0000 From: Bob Rossi To: =?utf-8?Q?=C3=96mer_Sinan_A=C4=9Facan?= Cc: gdb Subject: Re: GDB C API -- does such a thing exist? Message-ID: <20141016140154.GA11459@linux> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00039.txt.bz2 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