Implementing the `DW_CFA_remember_state` and `DW_CFA_restore_state`
according to the DWARF specification requires us to create a stack that
can store an arbitrary number of elements, that is, there could be
multiple "pushes" before "popping" them.
From the 5th revision of the spec [0]:
> 6.4.2.4 Row State Instructions
> DW_CFA_remember_state
> The DW_CFA_remember_state instruction takes no operands. The required
> action is to push the set of rules for every register onto an implicit stack.
> DW_CFA_restore_state
> DW_CFA_restore_state
> The DW_CFA_restore_state instruction takes no operands. The required action
> is to pop the set of rules off the implicit stack and place them in the
> current row.
- [0]: https://dwarfstd.org/doc/DWARF5.pdf
Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>
The repository is being switched from the personal account
github.com/derekparker/delve to the organization account
github.com/go-delve/delve. This patch updates imports and docs, while
preserving things which should not be changed such as my name in the
CHANGELOG and in TODO comments.
Support for position independent executables (PIE) on the native linux
backend, the gdbserver backend on linux and the core backend.
Also implemented in the windows native backend, but it can't be tested
because go doesn't support PIE on windows yet.
When creating a stack trace we should switch between the goroutine
stack and the system stack (where cgo code is executed) as appropriate
to reconstruct the logical stacktrace.
Goroutines that are currently executing on the system stack will have
the SystemStack flag set, frames of the goroutine stack will have a
negative FrameOffset (like always) and frames of the system stack will
have a positive FrameOffset (which is actually just the CFA value for
the frame).
Updates #935
Instead of only tracking a few cherrypicked registers in stack.go track
all DWARF registers.
This is needed for cgo code and for the locationlists emitted by go in
1.10:
* The debug_frame sections emitted by C compilers can not be used
without tracking all registers
* the loclists emitted by go1.10 need all registers of a frame to be
interpreted.