Tuesday, February 14, 2012
GDB: Changing/Modifying value of the variable
while doing debegging the application using GDB, at the run time variable values can be changed for easy debugging. Assume the there is while loop repeating for 100 times, but if you want to chech the values at 77th iteration. doing step by step will take lot of time and its not a good practice. using the set GDB command we can get this.see the example below
(gdb) p x
1ドル = 10
(gdb) set var x = 20
(gdb) p x
2ドル = 20
(gdb) set var x = 30
(gdb) p x
3ドル = 30
(gdb) set var x = -6
(gdb) p x
4ドル = -6
(gdb) p &x
5ドル = (int *) 0x7fffffffdc9c
gdb) set {int }0x7fffffffdc9c = -7
gdb) p x
6ドル = -7
(gdb)
For changing the variable value, use the set command with var as parameter saying to the GDB that x is a variable. In the above example, in line 14, changed the value of x using address also.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
A universally unique identifier ( UUID ) is an identifier standard used in software construction, standardized by the Open...
-
Recently I started working on Japser Studio professional for my new project Cloud to generate the reports. I was very new to all cloud ...
-
Below is C program for AVL Tree implementation. #include<stdio.h> #include<malloc.h> typedef struct bst { int info; int hei...
-
strcmp is another string library function which is used to compare two strings and returns zero if both strings are same , returns +ve valu...
-
One of the complex operation on binary search tree is deleting a node. Insertion is easy by calling recursive insertion. But deletion wont...
-
We have recently faced one tricky issue in AWS cloud while loading S3 file into Redshift using python. It took almost whole day to inde...
-
Object slicing: when a derived class object is assigned to a base class object. only base class data will be copied from derived class and...
-
We have faced lot of weird issues while loading S3 bucke t files into redshift. I will try to explain all issues what we faced. Before go...
-
Below code is to find the cube root of a given integer number with out using pow math library function. Its very simple and brute force...
-
Recently we faced one issue in reading messages from SQS in AWS cloud where we are processing same message multiple times. This issue we...
No comments:
Post a Comment