Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cmd/stackwhere/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ func TestListCollectionIncludesInstructionOnlyStackUsage(t *testing.T) {
}
}

func TestListCollectionIncludesVoidFunction(t *testing.T) {
cmd := root()
cmd.SetArgs([]string{"list", "../../testdata/noinline.o"})

var stdout bytes.Buffer
cmd.SetOut(&stdout)

if err := cmd.Execute(); err != nil {
t.Fatalf("list command failed: %v", err)
}

if got := stdout.String(); !strings.Contains(got, "0 bytes - helper") {
t.Fatalf("expected void helper in collection output, got %q", got)
}
}

func TestListCollectionWritesToConfiguredOutput(t *testing.T) {
cmd := root()
cmd.SetArgs([]string{"list", "../../testdata/basic.o"})
Expand Down
4 changes: 3 additions & 1 deletion internal/stackview/stackview.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ func isBPFProgram(n *dbgdwarf.Node) bool {
return false
}

if n.Entry().Val(dbgdwarf.AttrType) == nil {
// Concrete functions have an address or ranges. Unlike declarations, void
// functions have executable code but no return type attribute.
if n.Entry().Val(dbgdwarf.AttrLowpc) == nil && n.Entry().Val(dbgdwarf.AttrRanges) == nil {
return false
}

Expand Down