Re: test availability of variables in context from user command

Christophe Demarey
2007-02-23T18:16:17Z

Rob Quill wrote:
> I modifed GDB to make in possible to cehck whether variables are in
> scope. I'm not sure if that's what you want, but you can do things
> like:
>
> print $in_scope(var1);
>
> or in a command file:
>
> if($in_scope(var1) == 1)
>
> i.e. do something if var1 is in scope.
It's exactly what I want to check.
> At the moment it only covers
> certain cases as I haven't had time to finish it off, but it wouldn't
> be hard to do. I modified it against 6.6, but hopefully I can forge a
> patch out of it, if you want it.
Unfortunately, this solution doesn't fit our needs because our gdb user
commands will crash on non-patched gdb versions.
But I think it should be a good idea to have a such integrated
functionality (a full scripting language too).

Thanks a lot for your answers.

Regards,
Christophe.