View/Print function code from within GDB - Stack Overflow
At the moment, using the disassemble command I can print out the memory addresses for the user, but i want to print the actual source code instead. Can this be done in gdb?
Searching…
At the moment, using the disassemble command I can print out the memory addresses for the user, but i want to print the actual source code instead. Can this be done in gdb?
Print the starting and ending addresses of the compiled code for source line linespec. You can specify source lines in any of the ways understood by the list command (see section Printing source lines).
Print lines ending with last. Likewise, if last resolves to more than one source line in the program, then the list command prints the list of resolved source lines and does not proceed with the source code listing.
Since all of gdb is all in one window, when you are debugging you cannot see the source code for your program. To view the source code, type "list" or "l". gdb will print out the source code for the lines around the c...
Can anyone tell me which command is used to display the source code when debugging through GDB. Would be of great help.
Examining Source Files GDB can print parts of your program's source, since the debugging information recorded in the program tells GDB what source files were used to build it. When your program stops, GDB spontaneousl...
To print the source code of the current line being executed, GDB provides a straightforward command. This is useful for quick reference without switching context.
Another situation where it is helpful to show symbol filenames and line numbers is when disassembling code; GDB shows you the line number and source file that corresponds to each instruction.