String handling in GDB command language variables

Daniel Jacobowitz drow@mvista.com
Thu Feb 27 14:40:00 GMT 2003


On Thu, Feb 27, 2003 at 02:35:38PM -0000, Fyles, Matthew wrote:
> When not connected to any target is it possible to store a string value
> in a convenience variable.
> 
> i.e
> 
> sh-superh-elf-gdb -nw
> GNU gdb 5.2.1
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you
> are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
> details.
> This GDB was configured as "--host=i686-pc-linux-gnu
> --target=sh-superh-elf".
> (gdb) set $test=1
> (gdb) print $test
> $1 = 1
> (gdb) set $test="hello"
> evaluation of this expression requires the target program to be active
> (gdb)
> 
> can a convenience variable be made to be a string type within the
> command language?

The command language always mimics the current source language being
debugged, defaulting to C; C doesn't have a string type.  That's the
historical justification anyway.

If there's a consensus that a string type would be useful, it could
probably be done.  I think it might be a good idea; we could use
strings for arguments to gdb commands, etc.  However I'm not sure of
the syntax.

Anyone else out there have an opinion?
-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gdb mailing list