From e50e8da5c493b37bff754d816c11218eba03d715 Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Thu, 11 Jul 2024 08:19:38 +0800 Subject: pkg/report: remove args which already in ctx --- pkg/report/linux.go | 11 ++++------- pkg/report/linux_test.go | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'pkg') diff --git a/pkg/report/linux.go b/pkg/report/linux.go index dcdfda4b8..959089d70 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -17,7 +17,6 @@ import ( "github.com/google/syzkaller/pkg/report/crash" "github.com/google/syzkaller/pkg/symbolizer" "github.com/google/syzkaller/pkg/vcs" - "github.com/google/syzkaller/pkg/vminfo" "github.com/google/syzkaller/sys/targets" ) @@ -417,7 +416,7 @@ func (ctx *linux) symbolize(rep *Report) error { prefix := rep.reportPrefixLen for _, line := range bytes.SplitAfter(rep.Report, []byte("\n")) { line := bytes.Clone(line) - newLine := symbolizeLine(symbFunc, ctx.symbols, ctx.config.kernelModules, ctx.kernelBuildSrc, ctx, line) + newLine := symbolizeLine(symbFunc, ctx, line) if prefix > len(symbolized) { prefix += len(newLine) - len(line) } @@ -437,9 +436,7 @@ func (ctx *linux) symbolize(rep *Report) error { return nil } -func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, error), - symbols map[string]map[string][]symbolizer.Symbol, modules []*vminfo.KernelModule, strip string, - ctx *linux, line []byte) []byte { +func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, error), ctx *linux, line []byte) []byte { match := linuxSymbolizeRe.FindSubmatchIndex(line) if match == nil { return line @@ -457,7 +454,7 @@ func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, err if match[10] != -1 && match[11] != -1 { modName = string(line[match[10]:match[11]]) } - symb := symbols[modName][string(fn)] + symb := ctx.symbols[modName][string(fn)] if len(symb) == 0 { return line } @@ -474,7 +471,7 @@ func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, err pc-- } var bin string - for _, mod := range modules { + for _, mod := range ctx.config.kernelModules { if mod.Name == modName { bin = mod.Path break diff --git a/pkg/report/linux_test.go b/pkg/report/linux_test.go index 756576e98..f24b72d59 100644 --- a/pkg/report/linux_test.go +++ b/pkg/report/linux_test.go @@ -291,7 +291,7 @@ func TestLinuxSymbolizeLine(t *testing.T) { } for i, test := range tests { t.Run(fmt.Sprint(i), func(t *testing.T) { - result := symbolizeLine(symb, symbols, modules, "/linux", ctx, []byte(test.line)) + result := symbolizeLine(symb, ctx, []byte(test.line)) if test.result != string(result) { t.Errorf("want %q\n\t get %q", test.result, string(result)) } -- cgit mrf-deployment