[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interfacing gdb
From: |
Charles Manning |
Subject: |
Re: Interfacing gdb |
Date: |
Mon, 23 Feb 2009 10:35:46 +1300 |
User-agent: |
KMail/1.9.10 |
On Saturday 21 February 2009 06:06:56 Sam Steingold wrote:
> Charles Manning wrote:
> > On Saturday 14 February 2009 06:04:21 Maciej Piechotka wrote:
> >> Is it possible to write a plugin to gdb (i.e. program which may examin
> >> data provided by gdb - possibly from gdb)? Preferably in some sort of
> >> scripting language.
> >
> > You don't really need a plug in.
> >
> > gdb has a a very flexible built-in macro language that allows you to
> > write a lot of very useful scripts that can do all sorts of things.
>
> "flexible"?!
> gdb is a great debugger, but to say that the macro system is lacking is to
> make a gross understatement.
>
> e.g., http://article.gmane.org/gmane.comp.gdb.general/445:
>
> the following:
>
> define break_foo_bar
> break foo
> commands
> print x
> end
> break bar
> commands
> print y
> end
> end
>
> does not work because, apparently, the first "end" closes both
> "commands" and "define" and there is no file loaded at this time, so I
> get this error:
> .gdbinit:97: Error in sourced command file:
> No symbol table is loaded. Use the "file" command.
>
> Is there a way around this problem?
There are some ugly things like this.
How about this...
Instead of creating a break_foo_bar macro you instead make a break_foo_bar
command file (let's say break_foo_bar.cmd) containing:
break foo
commands
print x
end
break bar
commands
print y
end
When you want to run this, you type
source break_foo_bar.cmd
If you want, you should be able to maco-ize that:
define break_foo_bar
source break_foo_bar.cmd
end
and then have a macro