From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5986 invoked by alias); 16 Oct 2014 23:45:21 -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 5932 invoked by uid 89); 16 Oct 2014 23:45:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: elasmtp-curtail.atl.sa.earthlink.net Received: from elasmtp-curtail.atl.sa.earthlink.net (HELO elasmtp-curtail.atl.sa.earthlink.net) (209.86.89.64) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Oct 2014 23:45:19 +0000 Received: from [68.104.16.238] (helo=macbook2.local) by elasmtp-curtail.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1XeujN-0002gW-Oq for gdb@sourceware.org; Thu, 16 Oct 2014 19:45:17 -0400 Message-ID: <5440588D.8060503@earthlink.net> Date: Thu, 16 Oct 2014 23:45:00 -0000 From: Stan Shebs User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: gdb@sourceware.org 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-ELNK-Trace: ae6f8838ff913eba0cc1426638a40ef67e972de0d01da940628f4d23bf68b0851f71c6cba1ea40ce350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00052.txt.bz2 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