mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 09:46:56 +08:00
proc: keep track of nesting depth while reading compile units
Fully read compile units that contain nested entries we don't understand (such as DW_TAG_namespace) by keeping track of the depth we're at.
This commit is contained in:
committed by
Alessandro Arzilli
parent
8571fddbc1
commit
136f4de4b8
@ -337,3 +337,19 @@ func TestUnsupportedType(t *testing.T) {
|
||||
t.Errorf("unexpected error reading unsupported type: %#v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNestedCompileUnts(t *testing.T) {
|
||||
// Tests that a compile unit with a nested entry that we don't care about
|
||||
// (such as a DW_TAG_namespace) is read fully.
|
||||
dwb := dwarfbuilder.New()
|
||||
dwb.AddCompileUnit("main", 0x0)
|
||||
dwb.TagOpen(dwarf.TagNamespace, "namespace")
|
||||
dwb.AddVariable("var1", 0x0, uint64(0x0))
|
||||
dwb.TagClose()
|
||||
dwb.AddVariable("var2", 0x0, uint64(0x0))
|
||||
dwb.TagClose()
|
||||
bi, _ := fakeBinaryInfo(t, dwb)
|
||||
if n := len(bi.PackageVars()); n != 2 {
|
||||
t.Errorf("expected 2 variables, got %d", n)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user