This is the mail archive of the
mailing list for the GDB project.
RE: String handling in GDB command language variables
- From: "Fyles, Matthew" <matthew dot fyles at superh dot com>
- To: "Daniel Jacobowitz" <drow at mvista dot com>
- Cc: <gdb at sources dot redhat dot com>
- Date: Thu, 27 Feb 2003 14:35:38 -0000
- Subject: RE: String handling in GDB command language variables
When not connected to any target is it possible to store a string value
in a convenience variable.
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
welcome to change it and/or distribute copies of it under certain
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
This GDB was configured as "--host=i686-pc-linux-gnu
(gdb) set $test=1
(gdb) print $test
$1 = 1
(gdb) set $test="hello"
evaluation of this expression requires the target program to be active
can a convenience variable be made to be a string type within the
From: Daniel Jacobowitz [mailto:drow at mvista dot com]
Sent: Thursday, February 27, 2003 2:23 PM
To: Fyles, Matthew
Cc: gdb at sources dot redhat dot com
Subject: Re: String handling in GDB command language variables
On Thu, Feb 27, 2003 at 09:13:55AM -0000, Fyles, Matthew wrote:
> Just a quick question about the string handling capability of the GDB
> command language.
> set $test="mystring" does not work but defining a procedure and
> a string in as an argument does, is there any further documentation
> anywhere about the capabilities of the language other than the
> information available in the user documentation.
> Is this a feature that has been considered in the past and not
> implemented or am I just not understanding the syntax for achieving
When you say "mystring" in the GDB command language, what you really
get is malloc(9) called in the target program and "mystring" copied
However, you didn't say what version of GDB you were using. I just
tried it in 5.3:
(gdb) set $a = "a"
(gdb) p $a
$1 = 0x8244708 "a"
MontaVista Software Debian GNU/Linux Developer