delve/pkg/proc
aarzilli 290e8e7528 proc: support inlining
Go 1.10 added inlined calls to debug_info, this commit adds support
for DW_TAG_inlined_call to delve, both for stack traces (where
inlined calls will appear as normal stack frames) and to correct
the behavior of next, step and stepout.

The calls to Next and Frame of stackIterator continue to work
unchanged and only return real stack frames, after reading each line
appendInlinedCalls is called to unpacked all the inlined calls that
involve the current PC.

The fake stack frames produced by appendInlinedCalls are
distinguished from real stack frames by having the Inlined attribute
set to true. Also their Current and Call locations are treated
differently. The Call location will be changed to represent the
position inside the inlined call, while the Current location will
always reference the real stack frame. This is done because:

* next, step and stepout need to access the debug_info entry of
the real function they are stepping through
* we are already manipulating Call in different ways while Current
is just what we read from the call stack

The strategy remains mostly the same, we disassemble the function
and we set a breakpoint on each instruction corresponding to a
different file:line. The function in question will be the one
corresponding to the first real (i.e. non-inlined) stack frame.

* If the current function contains inlined calls, 'next' will not
set any breakpoints on instructions that belong to inlined calls. We
do not do this for 'step'.

* If we are inside an inlined call that makes other inlined
functions, 'next' will not set any breakpoints that belong to
inlined calls that are children of the current inlined call.

* If the current function is inlined the breakpoint on the return
address won't be set, because inlined frames don't have a return
address.

* The code we use for stepout doesn't work at all if we are inside
an inlined call, instead we call 'next' but instruct it to remove
all PCs belonging to the current inlined call.
2018-03-26 14:30:38 -04:00
..
core proc/core: Make TestCoreFpTest less flaky 2018-03-20 09:34:05 -07:00
gdbserial all: Spelling 2018-03-20 11:05:35 +01:00
native all: Spelling 2018-03-20 11:05:35 +01:00
test proc: support inlining 2018-03-26 14:30:38 -04:00
arch.go proc: support cgo stacktraces 2017-11-28 11:00:53 -08:00
bininfo.go proc: support inlining 2018-03-26 14:30:38 -04:00
breakpoints.go proc: next should not skip lines with conditional bps 2017-11-20 11:25:35 -08:00
disasm_amd64.go proc,vendor: show global variables in disassembly 2018-03-22 10:01:00 -07:00
disasm.go proc,vendor: show global variables in disassembly 2018-03-22 10:01:00 -07:00
doc.go Move top-level packages into pkg 2017-02-08 12:17:19 -08:00
dwarf_expr_test.go proc: support inlining 2018-03-26 14:30:38 -04:00
eval.go proc: support inlining 2018-03-26 14:30:38 -04:00
interface.go proc: remove proc.Process.Halt 2018-03-06 09:06:19 -08:00
mem.go proc: disable caching for variables with an extended location 2018-01-31 06:39:44 -08:00
moduledata.go dwarf/reader,proc: support DW_AT_abstract_origin (#1111) 2018-02-13 09:20:45 -08:00
proc_general_test.go proc: refactoring: split backends to separate packages 2017-04-21 14:00:04 -07:00
proc_test.go proc: support inlining 2018-03-26 14:30:38 -04:00
proc_unix_test.go proc: remove proc.Process.Kill 2018-03-06 09:06:19 -08:00
proc.go proc: support inlining 2018-03-26 14:30:38 -04:00
registers_amd64.go pkg/proc, pkg/dwarf/op: support DW_OP_piece, DW_OP_regX, DW_OP_fbreg 2017-11-21 11:51:02 -08:00
registers.go proc: refactor stack.go to use DWARF registers 2017-11-17 10:17:24 -08:00
scope_test.go proc: support inlining 2018-03-26 14:30:38 -04:00
stack.go proc: support inlining 2018-03-26 14:30:38 -04:00
threads.go proc: support inlining 2018-03-26 14:30:38 -04:00
types.go proc,vendor: show global variables in disassembly 2018-03-22 10:01:00 -07:00
variable_test.go Extend the "frame" command to set the current frame. (#1110) 2018-03-22 10:02:15 -07:00
variables.go proc: support inlining 2018-03-26 14:30:38 -04:00