Commentary: runtime debugging
This commit is contained in:
parent
4172c0f29e
commit
2be6f03848
|
|
@ -506,12 +506,29 @@ Runtime Debugging
|
||||||
=================
|
=================
|
||||||
|
|
||||||
To debug a Verilated executable, use the standard GNU debugger ``gdb`` or a
|
To debug a Verilated executable, use the standard GNU debugger ``gdb`` or a
|
||||||
similar tool. Typically you will want to have debugger symbols inserted by
|
similar tool, e.g.:
|
||||||
the compiler, assertions enabled in the C library, and assertions enabled
|
|
||||||
in the Verilated library. (These options slow down the executable, so do
|
|
||||||
this only when debugging.) To enable this, Verilate with:
|
|
||||||
|
|
||||||
-CFLAGS -ggdb -LDFLAGS -ggdb -CFLAGS -DVL_DEBUG=1 -CFLAGS -D_GLIBCXX_DEBUG
|
.. code-block:: bash
|
||||||
|
|
||||||
The :vlopt:`-CFLAGS` and/or :vlopt:`-LDFLAGS` options pass arguments
|
gdb obj_dir/Vmodel
|
||||||
directly to the compiler or linker.
|
run {Vmodel_command_arguments}
|
||||||
|
{segmentation faults}
|
||||||
|
bt
|
||||||
|
|
||||||
|
Typically you will want to have debugger symbols inserted by the compiler,
|
||||||
|
assertions enabled in the C library, assertions enabled in the Verilated
|
||||||
|
library, and the sanitizer enabled to look for bad memory or undefined
|
||||||
|
operations. (These options slow down the executable, so do this only when
|
||||||
|
debugging.) To enable these, Verilate with:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
-CFLAGS -ggdb -LDFLAGS -ggdb
|
||||||
|
-CFLAGS -DVL_DEBUG=1
|
||||||
|
-CFLAGS -D_GLIBCXX_DEBUG
|
||||||
|
-CFLAGS -fsanitize=address,undefined -LDFLAGS -fsanitize=address,undefined
|
||||||
|
|
||||||
|
The :vlopt:`-CFLAGS` and/or :vlopt:`-LDFLAGS` options used here pass the
|
||||||
|
following argument into the generated Makefile for use as compiler or
|
||||||
|
linker options respectively. If you are using your own Makefiles, adapt
|
||||||
|
appropriately to pass the suggested flags to the compiler and linker.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue