Skip to content

How to run Hercules under the gdb debugger #707

@Fish-Git

Description

@Fish-Git

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!)

Metadata

Metadata

Assignees

Labels

DiscussionDevelopers 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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions