提交 77c95536 编写于 作者: A aarzilli 提交者: Derek Parker

proc: handle DW_TAG_subprogram with a nochildren abbrev

On macOS, externally linked programs will have an abbrev for
DW_TAG_subprogram without the haschildren flag set. We should handle
this case instead of expecting all DW_TAG_subprogram entries to have
list of children.

Fixes #1034
上级 17bd4b52
......@@ -55,7 +55,7 @@ func (vrdr *VariableReader) Next() bool {
}
}
if recur {
if recur && vrdr.entry.Children {
vrdr.depth++
} else {
if vrdr.depth == 0 {
......
......@@ -3337,3 +3337,21 @@ func TestSystemstackStacktrace(t *testing.T) {
}
})
}
func TestIssue1034(t *testing.T) {
// The external linker on macOS produces an abbrev for DW_TAG_subprogram
// without the "has children" flag, we should support this.
withTestProcess("cgostacktest/", t, func(p proc.Process, fixture protest.Fixture) {
_, err := setFunctionBreakpoint(p, "main.main")
assertNoError(err, t, "setFunctionBreakpoint()")
assertNoError(proc.Continue(p), t, "Continue()")
frames, err := p.SelectedGoroutine().Stacktrace(10)
assertNoError(err, t, "Stacktrace")
scope := proc.FrameToScope(p, frames[2])
args, _ := scope.FunctionArguments(normalLoadConfig)
assertNoError(err, t, "FunctionArguments()")
if len(args) > 0 {
t.Fatalf("wrong number of arguments for frame %v (%d)", frames[2], len(args))
}
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册