From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3444 invoked by alias); 21 Jun 2010 13:20:32 -0000 Received: (qmail 3434 invoked by uid 22791); 21 Jun 2010 13:20:31 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Jun 2010 13:20:23 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5LDKKI6021047 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Jun 2010 09:20:21 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5LDKJg0022853; Mon, 21 Jun 2010 09:20:20 -0400 Message-ID: <4C1F6713.1040000@redhat.com> Date: Mon, 21 Jun 2010 13:20:00 -0000 From: Phil Muldoon User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4 MIME-Version: 1.0 To: petrucristescu CC: gdb@sourceware.org Subject: Re: Java to gdb References: <28948301.post@talk.nabble.com> In-Reply-To: <28948301.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2010-06/txt/msg00084.txt.bz2 On 06/21/2010 02:04 PM, petrucristescu wrote: > > Hello, > > I'm trying to interact wtih gdb from a Java application. What I want to do > is to create a Java GUI and form that GUI to send commands to gdb. So, > instead of writing commands in gdb command line interface I want to interact > via software with GDB. I know that is possible because in Eclipse this is > implemented. Eclipse is (I believe) implementing the MI protocol. I think there are various abstractions within Eclipse for this. If you want to go that route, check out Chapter 27 "The gdb/mi Interface" in the GDB on-line documentation. (http://sourceware.org/gdb/current/onlinedocs/gdb/) > What I tried is to send commands from Java to the pty where the gdb is > running. I've tried both with mi and cli but apparently I'm only able to > write in the terminal and not execute the commands. Yeah there are many different challenges with this. You can use Python to script GDB if that will do. There are few other ways as well. If you really want to go the way of using Java to script GDB (and I would not recommend it), I would look at the Python code in the python/ directory in GDB to understand the challenges involved. An in-depth discussion can be found at "23 Extending gdb" and in particular "23.2 Scripting gdb using Python" Cheers, Phil