This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Java to gdb
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: petrucristescu <petru dot cristescu at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 21 Jun 2010 14:20:19 +0100
- Subject: Re: Java to gdb
- References: <28948301.post@talk.nabble.com>
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