From the course: Debugging C Code

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Dumping memory

Dumping memory - C Tutorial

From the course: Debugging C Code

Start my 1-month free trial

Dumping memory

- [Instructor] As with an IDE debugger, you can use GDB, to examine a chunk of memory, though, well, it's not as elegant. So I've compiled exercise file, 0303, dump1,c, see what it does and it outputs some binary numbers, some powers of two to see what's going on in memory I'll debug the program and list the code to see what it looks like and there it is. Now I'm going to set a breakpoint in the middle of the four loop, here at line 13 and run and the program stops at the breakpoint. Now let's check the value of pointer a, and it's off in memory somewhere but what's in memory? To list the values use the x command followed by an address where x stands for examine, and the address is conveniently stored in pointer variable a. The value shown is in hexadecimal, which is actually 64 decimal, and to prove it, you can do examine in decimal, the d is for decimal, the contents of variable a and there you see the value 64.…

Contents