Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB GUI
@ 2009-11-02 10:57 Marco Menegazzi
  2009-11-02 16:36 ` Sérgio Durigan Júnior
  0 siblings, 1 reply; 12+ messages in thread
From: Marco Menegazzi @ 2009-11-02 10:57 UTC (permalink / raw)
  To: gdb

Hi!
I'm new with gdb and I need help about writing a simple gui to control  
gdb output.
I just need something that permits me to send commands as from the  
textual interface and receive output as it is ... the main aspect I've  
to work on is variable inspection so I don't need to create a real  
frontend with a mess of functions ... I just need something that  
permits me to start gdb under a Java (for example) program and control  
it as I am writing on terminal.
Thanks.

Marco Menegazzi


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-02 10:57 GDB GUI Marco Menegazzi
@ 2009-11-02 16:36 ` Sérgio Durigan Júnior
  2009-11-04 14:30   ` Marco Menegazzi
  0 siblings, 1 reply; 12+ messages in thread
From: Sérgio Durigan Júnior @ 2009-11-02 16:36 UTC (permalink / raw)
  To: gdb; +Cc: Marco Menegazzi

Hi Marco,

On Monday 02 November 2009, Marco Menegazzi wrote:
> Hi!
> I'm new with gdb and I need help about writing a simple gui to control
> gdb output.
> I just need something that permits me to send commands as from the
> textual interface and receive output as it is ... the main aspect I've
> to work on is variable inspection so I don't need to create a real
> frontend with a mess of functions ... I just need something that
> permits me to start gdb under a Java (for example) program and control
> it as I am writing on terminal.

I believe you're looking for the GDB MI interface.  You can find more 
information about it here:

http://sources.redhat.com/gdb/onlinedocs/gdb_28.html#SEC274

If you have any question that are not answered by the manual, get back to this 
mailing list :-).

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-02 16:36 ` Sérgio Durigan Júnior
@ 2009-11-04 14:30   ` Marco Menegazzi
  2009-11-04 14:36     ` André Pönitz
                       ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Marco Menegazzi @ 2009-11-04 14:30 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb


Thank you.

I've already seen that documentation but my problem is that it does  
not explain how to connect to this interface through code. It explains  
how it is but not how to use it ... I want to connect through my java  
code but the only idea I have is to call it directly from the code  
with Runtime.exec ... but then I ask myself why to use gdb/mi that  
returns a more complex output instead of calling directly gdb and  
parse the stout to get what I want?

Sorry if my questions appear to be stupid but I'm very new of this ...

Il giorno 02/nov/2009, alle ore 17.36, Sérgio Durigan Júnior ha scritto:

> Hi Marco,
>
> On Monday 02 November 2009, Marco Menegazzi wrote:
>> Hi!
>> I'm new with gdb and I need help about writing a simple gui to  
>> control
>> gdb output.
>> I just need something that permits me to send commands as from the
>> textual interface and receive output as it is ... the main aspect  
>> I've
>> to work on is variable inspection so I don't need to create a real
>> frontend with a mess of functions ... I just need something that
>> permits me to start gdb under a Java (for example) program and  
>> control
>> it as I am writing on terminal.
>
> I believe you're looking for the GDB MI interface.  You can find more
> information about it here:
>
> http://sources.redhat.com/gdb/onlinedocs/gdb_28.html#SEC274
>
> If you have any question that are not answered by the manual, get  
> back to this
> mailing list :-).
>
> -- 
> Sérgio Durigan Júnior
> Linux on Power Toolchain - Software Engineer
> Linux Technology Center - LTC
> IBM Brazil


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-04 14:30   ` Marco Menegazzi
@ 2009-11-04 14:36     ` André Pönitz
  2009-11-04 15:02     ` Vladimir Prus
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: André Pönitz @ 2009-11-04 14:36 UTC (permalink / raw)
  To: gdb

On Wednesday 04 November 2009 15:32:49 Marco Menegazzi wrote:
> 
> Thank you.
> 
> I've already seen that documentation but my problem is that it does  
> not explain how to connect to this interface through code. It explains  
> how it is but not how to use it ... I want to connect through my java  
> code but the only idea I have is to call it directly from the code  
> with Runtime.exec ... but then I ask myself why to use gdb/mi that  
> returns a more complex output instead of calling directly gdb and  
> parse the stout to get what I want?

The MI output is _much_ simpler to parse than the command line output.

Andre'


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-04 14:30   ` Marco Menegazzi
  2009-11-04 14:36     ` André Pönitz
@ 2009-11-04 15:02     ` Vladimir Prus
  2009-11-04 20:06     ` Sérgio Durigan Júnior
  2009-11-05  8:10     ` Nick Roberts
  3 siblings, 0 replies; 12+ messages in thread
From: Vladimir Prus @ 2009-11-04 15:02 UTC (permalink / raw)
  To: gdb

Marco Menegazzi wrote:

> 
> Thank you.
> 
> I've already seen that documentation but my problem is that it does
> not explain how to connect to this interface through code. It explains
> how it is but not how to use it ... I want to connect through my java
> code but the only idea I have is to call it directly from the code
> with Runtime.exec ... but then I ask myself why to use gdb/mi that
> returns a more complex output instead of calling directly gdb and
> parse the stout to get what I want?

Eclipse CDT has an implementation of all this. Look for things such
as MIInferior, RxThread and TxThread in a full CDT checkout.

As for parsing stdout -- traditional GDB output is meant for humans. Unless
you plan on adding AI module to your application, it's just not possible
to reliably parse it.

- Volodya



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-04 14:30   ` Marco Menegazzi
  2009-11-04 14:36     ` André Pönitz
  2009-11-04 15:02     ` Vladimir Prus
@ 2009-11-04 20:06     ` Sérgio Durigan Júnior
  2009-11-04 20:15       ` Joel Brobecker
  2009-11-05  8:10     ` Nick Roberts
  3 siblings, 1 reply; 12+ messages in thread
From: Sérgio Durigan Júnior @ 2009-11-04 20:06 UTC (permalink / raw)
  To: Marco Menegazzi; +Cc: gdb

On Wednesday 04 November 2009, Marco Menegazzi wrote:
> I've already seen that documentation but my problem is that it does
> not explain how to connect to this interface through code. It explains
> how it is but not how to use it ... I want to connect through my java
> code but the only idea I have is to call it directly from the code
> with Runtime.exec ... but then I ask myself why to use gdb/mi that
> returns a more complex output instead of calling directly gdb and
> parse the stout to get what I want?

I understand what you mean.  Sorry, I can't help you on that because I'm 
totally newbie in this area.  However, I'd suggest you to see how other GUIs 
do that (Eclipse, for example).  Based on that, I believe you'll have a good 
start point.

> Sorry if my questions appear to be stupid but I'm very new of this ...

No problem at all!  I'm actually learning more about this topic with your 
questions :-).

Regards,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-04 20:06     ` Sérgio Durigan Júnior
@ 2009-11-04 20:15       ` Joel Brobecker
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Brobecker @ 2009-11-04 20:15 UTC (permalink / raw)
  To: S?rgio Durigan J?nior; +Cc: Marco Menegazzi, gdb

> On Wednesday 04 November 2009, Marco Menegazzi wrote:
> > I've already seen that documentation but my problem is that it does
> > not explain how to connect to this interface through code. It explains
> > how it is but not how to use it ... I want to connect through my java
> > code but the only idea I have is to call it directly from the code
> > with Runtime.exec ... but then I ask myself why to use gdb/mi that
> > returns a more complex output instead of calling directly gdb and
> > parse the stout to get what I want?

What we do in AdaCore's IDE is to create a pseudo-tty, and launch
the debugger using that pseudo-tty.  That way, GDB thinks it is in
a terminal, and we get to send commands and receive their output.
I believe that this is also what tools such as "expect" do. The code
we used was originally taken from the emacs sources, so you might
be able to find some C code that does just that. Or perhaps Java
has some library classes that do that for you.

-- 
Joel


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-04 14:30   ` Marco Menegazzi
                       ` (2 preceding siblings ...)
  2009-11-04 20:06     ` Sérgio Durigan Júnior
@ 2009-11-05  8:10     ` Nick Roberts
  2009-11-06 16:41       ` Marco Menegazzi
  3 siblings, 1 reply; 12+ messages in thread
From: Nick Roberts @ 2009-11-05  8:10 UTC (permalink / raw)
  To: Marco Menegazzi; +Cc: Sérgio Durigan Júnior, gdb

 >                  ... but then I ask myself why to use gdb/mi that  
 > returns a more complex output instead of calling directly gdb and  
 > parse the stout to get what I want?

Because, over time, normal GDB output is likely to change in a way that will
break your parser.  In contrast, GDB/MI output shouldn't change in unexpected
ways.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-05  8:10     ` Nick Roberts
@ 2009-11-06 16:41       ` Marco Menegazzi
  2009-11-07  6:58         ` Nick Roberts
  2009-11-07 10:20         ` Daniel Jacobowitz
  0 siblings, 2 replies; 12+ messages in thread
From: Marco Menegazzi @ 2009-11-06 16:41 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Sérgio Durigan Júnior, gdb


So if I am not interested in future developements of gdb, because I am  
not working on a gdb frontend but I only need to use gdb under my  
graphical application, could it be useful to interact with gdb instead  
of gdb/mi ? It is just a question to understand if I really need to  
use gdb-mi in my case ...
Thank you all for the answers.



Il giorno 05/nov/2009, alle ore 09.10, Nick Roberts ha scritto:

>>                 ... but then I ask myself why to use gdb/mi that
>> returns a more complex output instead of calling directly gdb and
>> parse the stout to get what I want?
>
> Because, over time, normal GDB output is likely to change in a way  
> that will
> break your parser.  In contrast, GDB/MI output shouldn't change in  
> unexpected
> ways.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-06 16:41       ` Marco Menegazzi
@ 2009-11-07  6:58         ` Nick Roberts
  2009-11-07 10:20         ` Daniel Jacobowitz
  1 sibling, 0 replies; 12+ messages in thread
From: Nick Roberts @ 2009-11-07  6:58 UTC (permalink / raw)
  To: Marco Menegazzi; +Cc: Sérgio Durigan Júnior, gdb

 > So if I am not interested in future developements of gdb, because I am  
 > not working on a gdb frontend but I only need to use gdb under my  
 > graphical application, could it be useful to interact with gdb instead  
 > of gdb/mi ? 

I don't know what the difference is between a gdb frontend and "using gdb
under a graphical application" so I probably don't understand what you are
trying to do.

-- 
Nick                                           http://users.snap.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB GUI
  2009-11-06 16:41       ` Marco Menegazzi
  2009-11-07  6:58         ` Nick Roberts
@ 2009-11-07 10:20         ` Daniel Jacobowitz
  2009-11-07 11:22           ` Marc Khouzam
  1 sibling, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2009-11-07 10:20 UTC (permalink / raw)
  To: Marco Menegazzi; +Cc: Nick Roberts, Sérgio Durigan Júnior, gdb

On Fri, Nov 06, 2009 at 11:59:10AM +0100, Marco Menegazzi wrote:
> 
> So if I am not interested in future developements of gdb, because I
> am not working on a gdb frontend but I only need to use gdb under my
> graphical application, could it be useful to interact with gdb
> instead of gdb/mi ? It is just a question to understand if I really
> need to use gdb-mi in my case ...
> Thank you all for the answers.

I really strongly recommend you use GDB/MI.

It's a little trickier to get started, because you're not already
familiar with exactly how GDB/MI looks; you probably know what the GDB
CLI looks like.  But the GDB CLI is unpredictable and guaranteed to
generate output you can't parse.  It changes between releases, between
systems, and more.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: GDB GUI
  2009-11-07 10:20         ` Daniel Jacobowitz
@ 2009-11-07 11:22           ` Marc Khouzam
  0 siblings, 0 replies; 12+ messages in thread
From: Marc Khouzam @ 2009-11-07 11:22 UTC (permalink / raw)
  To: Daniel Jacobowitz, Marco Menegazzi
  Cc: Nick Roberts, Sérgio Durigan Júnior, gdb

> -----Original Message-----
> From: gdb-owner@sourceware.org 
> [mailto:gdb-owner@sourceware.org] On Behalf Of Daniel Jacobowitz
> Sent: November-06-09 4:50 PM
> To: Marco Menegazzi
> Cc: Nick Roberts; Sérgio Durigan Júnior; gdb@sourceware.org
> Subject: Re: GDB GUI
> 
> On Fri, Nov 06, 2009 at 11:59:10AM +0100, Marco Menegazzi wrote:
> > 
> > So if I am not interested in future developements of gdb, because I
> > am not working on a gdb frontend but I only need to use gdb under my
> > graphical application, could it be useful to interact with gdb
> > instead of gdb/mi ? It is just a question to understand if I really
> > need to use gdb-mi in my case ...
> > Thank you all for the answers.
> 
> I really strongly recommend you use GDB/MI.


If you want an example you can look at some Eclipse code.
Below is some information on how to check it out with CVS.
But in case that is too intimidating, you can look at the code on the web.
Here are the interesting files:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/?root=Tools_Project

look for MIParser.java
In fact, here is the link to the MIParser.java:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java?revision=1.1&root=Tools_Project&view=markup

To check out using CVS:
pserver:anonymous@proxy.eclipse.org:80
under
/cvsroot/tools
under
HEAD/org.eclipse.cdt/dsf-gdb

get the plugin
org.eclipse.cdt.dsf.gdb
and look at
MIParser.java

Marc


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-11-07  1:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-02 10:57 GDB GUI Marco Menegazzi
2009-11-02 16:36 ` Sérgio Durigan Júnior
2009-11-04 14:30   ` Marco Menegazzi
2009-11-04 14:36     ` André Pönitz
2009-11-04 15:02     ` Vladimir Prus
2009-11-04 20:06     ` Sérgio Durigan Júnior
2009-11-04 20:15       ` Joel Brobecker
2009-11-05  8:10     ` Nick Roberts
2009-11-06 16:41       ` Marco Menegazzi
2009-11-07  6:58         ` Nick Roberts
2009-11-07 10:20         ` Daniel Jacobowitz
2009-11-07 11:22           ` Marc Khouzam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox