-
Notifications
You must be signed in to change notification settings - Fork 109
How to run Hercules under the gdb debugger #707
Copy link
Copy link
Closed
Labels
DiscussionDevelopers are invited to discuss a design change or solution to a coding problem.Developers are invited to discuss a design change or solution to a coding problem.LLinux reported or Linux-only issue, such as with tuntap networking that doesn't occur on Windows.Linux reported or Linux-only issue, such as with tuntap networking that doesn't occur on Windows.
Metadata
Metadata
Assignees
Labels
DiscussionDevelopers are invited to discuss a design change or solution to a coding problem.Developers are invited to discuss a design change or solution to a coding problem.LLinux reported or Linux-only issue, such as with tuntap networking that doesn't occur on Windows.Linux reported or Linux-only issue, such as with tuntap networking that doesn't occur on Windows.
PREAMBLE:
The following might not be perfectly accurate (since I am NOT a Linux person!), but it seems to work for me.
Linux experts who are familiar with (skilled at) debugging programs under gdb are encouraged to provide thoughtful feedback, KEEPING IN MIND that my primary goal in creating this issue is to simply document how to get started with running Hercules under gdb. My goal is NOT to provide a comprehensive gdb debugging tutorial!
With that in mind, here is how I do it:
Debugging Hercules via GDB...
For various gdb commands, refer to:
(if anyone has a better reference, let me know!)
PROCEDURE
Tell gdb where Hercules binaries are located. Note that the below is required so that gdb can find and load Hercules's binaries:
export LD_LIBRARY_PATH=/home/<user>/hercules/hercules-0/.libsStart gdb, telling it which program you want it to debug:
gdb /home/<user>/hercules/hercules-0/.libs/herculesOnce in gdb, ask gdb to start running Hercules:
run -f none > ~/hercules.log(Note: the(gdb)in the below example is gdb's command prompt, not part of any gdb command itself! Also ignore the line comments too, obviously!)(gdb) run -f none > ~/hercules.log (start your program with whatever arguments desired. In this example, I am not specifying any Hercules configuration file) (gdb) ............... (breakpoint hit, issue gdb commands as needed to fully investigate why the breakpoint was triggered; refer to gdb documentation) (gdb) continue (when done investigating, ask gdb to continue running Hercules normally again) (after 'exit'ing from Hercules, you will then be returned back to gdb) (gdb) quit (ask gdb to quit and return back to shell)export LD_LIBRARY_PATH=(i.e. set back to nothing? i.e. to empty string?)THAT'S IT!
(The Linux geeks are probably laughing at me now!)