I know that I can output the value of a variable using
(gdb) p var_name
$1 = "varvalue"
Is there a way to set the value of a variable while debugging with gdb? The document that I'm using doesn't seem to have this command.
Edit
I've since learned that I can change the state of objects in memory by simply calling their functions! So to modify an object of type std::string
, just call the assign
function as follows:
(gdb) call str.assign("New Value")
Thank you.