This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Alternate approach to keeping convenience variables


Jim Blandy wrote:
On 1/24/06, Daniel Jacobowitz <drow@false.org> wrote:
Right, but there's no way to test for that in the scripting language.
Your 'init-if-undefined' command has to be a primitive, implemented in
C.  My argument was that having the variables always be present is
more convenient for user-defined commands.
Andrew's point is that such a primitive was recently committed :-)

If you want your user-defined command to print a helpful error mesage, you can't use that in an 'if'. If we had some operator like $defined($foo), then that'd be different.

I'm not totally sure what you mean by this.


I put the following into the wavefront GDB and it works as I expected:

define defined
 set $temp = $arg0
 init-if-undefined $temp = 99999
 if $temp == 99999
  echo $arg0 not defined\n
 end
end


(gdb) defined $a $a not defined (gdb) defined $tpnum (gdb)

It has its limitations, of course, but it does work. Your suggestion would still be better.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]