[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: How to use gdb in LINUX?



M.K. Saravanan wrote:
> 
> Dear friends,
>
> a small eg. on how to use gdb?
> 
OK 
 Some would suggest Xemacs + gdb and some others ddd or xxgdb.
But gdb by itself is way too cool.

Start gdb
$gdb <executable-file>

First set a breakpoint( in main() ) using 
(gdb) b main

And run using 

(gdb) r

To step (but not into functions)
(gdb) n

To step into functions
(gdb) s

To view a variable
(gdb)p <expression>

To set a watch to see a variable whenever it changes
(gdb)w <expression>

And hey I almost forgot,
(gdb)disassemble

to get the assembly instructions!! 

This would help you to get started and now "info gdb" might make more sense.


------------------------------