Skip to main content
Add syntax for the code
Source Link
jvoisin
  • 2.5k
  • 17
  • 23

Google is your friend:

For example, if your program has a variable width, you get an error if you try to set a new value with just `set width=13', because GDB has the command set width:

(gdb) whatis width
type = double
(gdb) p width $4 = 13
(gdb) set width=47
Invalid syntax in expression.


(gdb) whatis width  
type = double   
(gdb) p width $4 = 13  
(gdb) set width=47  
Invalid syntax in expression. 

The invalid expression, of course, is `=47'. In order to actually set the program's variable width, use

(gdb) set var width=47


(gdb) set var width=47

You can find the needed information in the following document:

Google is your friend:

For example, if your program has a variable width, you get an error if you try to set a new value with just `set width=13', because GDB has the command set width:

(gdb) whatis width
type = double
(gdb) p width $4 = 13
(gdb) set width=47
Invalid syntax in expression.

The invalid expression, of course, is `=47'. In order to actually set the program's variable width, use

(gdb) set var width=47

You can find the needed information in the following document:

Google is your friend:

For example, if your program has a variable width, you get an error if you try to set a new value with just `set width=13', because GDB has the command set width:


(gdb) whatis width  
type = double   
(gdb) p width $4 = 13  
(gdb) set width=47  
Invalid syntax in expression. 

The invalid expression, of course, is `=47'. In order to actually set the program's variable width, use


(gdb) set var width=47

You can find the needed information in the following document:

Source Link
PhoeniX
  • 3.1k
  • 17
  • 30

Google is your friend:

For example, if your program has a variable width, you get an error if you try to set a new value with just `set width=13', because GDB has the command set width:

(gdb) whatis width
type = double
(gdb) p width $4 = 13
(gdb) set width=47
Invalid syntax in expression.

The invalid expression, of course, is `=47'. In order to actually set the program's variable width, use

(gdb) set var width=47

You can find the needed information in the following document: