In gdb stepping, you can change the value of a variable by running:
(gdb) set myvar=5
to change the variable myvar to 5.
Because an std::string is not a primitive data type, it cannot be changed in this way.
The std::string is a class and it has methods that you can call in gdb to change the value of an instance of it. For example, if mystring is an object of std::string, you can do either:
(gdb) call mystring.assign("new value")
or
(gdb) call mystring.operator=("new value")
to change the value of mystring into "new value".
Saturday, April 13, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment