Skip to content
Open
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: 14 additions & 2 deletions internal/driver/webui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func TestWebInterface(t *testing.T) {
[]string{"300ms.*F1", "200ms.*300ms.*F2"}, false},
{"/disasm?f=" + url.QueryEscape("F[12]"),
[]string{"f1:asm", "f2:asm"}, false},
{"/disasm?f=" + url.QueryEscape("^F2$"),
[]string{"ROUTINE ======================== F2"}, false},
{"/flamegraph", []string{
"File: testbin",
// Check that interesting frames are included.
Expand Down Expand Up @@ -168,7 +170,7 @@ func (f fakeObj) SourceLine(addr uint64) ([]plugin.Frame, error) {
return nil, fmt.Errorf("SourceLine unimplemented")
}
func (f fakeObj) Symbols(r *regexp.Regexp, addr uint64) ([]*plugin.Sym, error) {
return []*plugin.Sym{
syms := []*plugin.Sym{
{
Name: []string{"F1"}, File: fakeSource,
Start: addrBase, End: addrBase + 10,
Expand All @@ -181,7 +183,17 @@ func (f fakeObj) Symbols(r *regexp.Regexp, addr uint64) ([]*plugin.Sym, error) {
Name: []string{"F3"}, File: fakeSource,
Start: addrBase + 20, End: addrBase + 30,
},
}, nil
}
if r == nil {
return syms, nil
}
var matched []*plugin.Sym
for _, sym := range syms {
if r.MatchString(sym.Name[0]) {
matched = append(matched, sym)
}
}
return matched, nil
}

type fakeObjTool struct{}
Expand Down
2 changes: 1 addition & 1 deletion internal/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func symbolsFromBinaries(prof *profile.Profile, g *graph.Graph, rx *regexp.Regex
// samples and are matched to the regexp.
fileHasSamplesAndMatched := make(map[string]bool)
for _, n := range g.Nodes {
if name := n.Info.PrintableName(); rx.MatchString(name) && n.Info.Objfile != "" {
if n.Info.Objfile != "" && (rx.MatchString(n.Info.Name) || rx.MatchString(n.Info.PrintableName())) {
fileHasSamplesAndMatched[n.Info.Objfile] = true
}
}
Expand Down