Output formats (debugging with gdb)by default, gdb prints a value according to its data type Gdb program_name so, for example, if you wanted to debug the program main, you would run Sometimes this is not what you want
For example, you might want to print a number in hex, or a pointer in decimal This is done by running gdb using the following format Or you might want to view data in memory at a certain address as a character string or as an instruction
The simplest use of output formats is to say how to print a value already computed This is done by starting the arguments of the print command with a slash and a format letter. Debugging output gdb offers many more ways to debug and understand your code like examining stack, memory, threads, manipulating the program, etc I hope the above example helps you get started with gdb
Conclusion in this article we have discussed gdb (gnu debugger) which is a powerful tool in linux used for debugging c programs. By default, gdb prints a value according to its data type Output formats10.5 output formats by default, gdb prints a value according to its data type To do these things, specify an output format when you print a.
For example, to print the program counter in hex (see registers), type. Using the command line debugger once you have compiled an executable file that includes a debugging symbol table, you debug it by opening it in gdb