Re: Interfacing gdb

Sam Steingold <[email protected]> Fri, 20 Feb 2009 12:06:56 -0500
Newsgroups gmane.comp.gdb.general
Message-ID <[email protected]>
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?