Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run Hercules under the gdb debugger #707

Closed
Fish-Git opened this issue Jan 24, 2025 · 1 comment
Closed

How to run Hercules under the gdb debugger #707

Fish-Git opened this issue Jan 24, 2025 · 1 comment
Assignees
Labels
Discussion Developers are invited to discuss a design change or solution to a coding problem. L Linux only issue, such as with tuntap networking that doesn't occur on Windows.

Comments

@Fish-Git
Copy link
Member

Fish-Git commented Jan 24, 2025

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

  1. 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/.libs

  2. Start gdb, telling it which program you want it to debug:     gdb /home/<user>/hercules/hercules-0/.libs/hercules

  3. Once 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)
  1. Afterwards, don't forget to reset "LD_LIBRARY_PATH" back to what it was!     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!)

@Fish-Git Fish-Git self-assigned this Jan 24, 2025
@Fish-Git Fish-Git added Discussion Developers are invited to discuss a design change or solution to a coding problem. L Linux only issue, such as with tuntap networking that doesn't occur on Windows. labels Jan 24, 2025
@Fish-Git Fish-Git pinned this issue Jan 24, 2025
@Fish-Git
Copy link
Member Author

There's no need to keep this issue open. It's just a dummy "FYI reference" issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Developers are invited to discuss a design change or solution to a coding problem. L Linux only issue, such as with tuntap networking that doesn't occur on Windows.
Projects
None yet
Development

No branches or pull requests

1 participant