--gdb flag does not work
|Assignee:||Jeremy Bennett||% Done:|
Although not documented in the main manual, the internals guide notes the use of --gdb to start Verilator tests under the GNU debugger.
The internals document is slightly in error, since the usage is not --gdb, but --gdb <debugger>, thus giving the user the option of using another debugger (for example ddd).
The other problem is that the invocation of gdb is constructed as:
gdb $VERILATOR_ROOT/verilator_bin_dbg <verilator arg> <verilator arg> ...
GDB does not pass arguments to the inferior (i.e. the program being debugged) in this way, it expects them to be preceded by --args:
gdb $VERILATOR_ROOT/verilator_bin_dbg --args <verilator arg> <verilator arg> ...
This requires a small modification to the verilator PERL script, which in turn requires that any debugger used with the --gdb option to Verilator follow this convention.
I attach a patch against current git HEAD (commit 0ae00fc921f18fc3dbcd3a50400f8e3c528f5c51) for these changes.
#1 Updated by Wilson Snyder almost 2 years ago
Yup, need some more documentation here, thanks for the patch.
The --gdb flag presumes a script which starts gdb. Note --gdb on a test invocation (test_regress/t/t_FOO.pl --gdb) presumes that script "gdbrun" by default.
--args intentionally isn't there because some non-gdb debuggers do not support that switch.
I can put the gdbrun script into the distribution but that doesn't feel right as it has personal preferences and is another layer that people shouldn't have to be burdened with.
My inclination then is to make --gdb behave like --gdbbt without the automatic exit. If VERILATOR_GDB environment variable is set it will override this behavior and allow an arbitrary script to be called (for other debuggers).