mirror of
https://github.com/YosysHQ/yosys
synced 2025-12-01 01:37:14 +00:00
The workflow of debugging fatal pass errors in Yosys is flawed in
three ways:
1. Running Yosys under a debugger is sufficient for the debugger
to catch some fatal errors (segfaults, aborts, STL exceptions)
but not others (`log_error()`, `log_cmd_error()`). This is
neither obvious nor easy to remember.
2. To catch Yosys-specific fatal errors, it is necessary to set
a breakpoint at `logv_error_with_prefix()`, or at least,
`logv_error()`. This is neither obvious nor easy to remember,
and GDB's autocomplete takes many seconds to suggest function
names due to the large amount of symbols in Yosys.
3. If a breakpoint is not set and Yosys encounters with such
a fatal error, the process terminates. When debugging a crash
that takes a long time to reproduce (or a nondeterministic crash)
this can waste a significant amount of time.
To solve this problem, add a macro `YS_DEBUGTRAP` that acts as a hard
breakpoint (if available), and a macro `YS_DEBUGTRAP_IF_DEBUGGING`
that acts as a hard breakpoint only if debugger is present.
Then, use `YS_DEBUGTRAP_IF_DEBUGGING` in `logv_error_with_prefix()`
to obviate the need for a breakpoint on nearly every platform.
Co-Authored-By: Alberto Gonzalez <boqwxp@airmail.cc>
|
||
|---|---|---|
| .. | ||
| bitpattern.h | ||
| calc.cc | ||
| cellaigs.cc | ||
| cellaigs.h | ||
| celledges.cc | ||
| celledges.h | ||
| celltypes.h | ||
| consteval.h | ||
| constids.inc | ||
| cost.h | ||
| driver.cc | ||
| hashlib.h | ||
| log.cc | ||
| log.h | ||
| macc.h | ||
| modtools.h | ||
| register.cc | ||
| register.h | ||
| rtlil.cc | ||
| rtlil.h | ||
| satgen.h | ||
| sigtools.h | ||
| timinginfo.h | ||
| utils.h | ||
| yosys.cc | ||
| yosys.h | ||