From a616ed5608866d49964391811f824b2e74cfb319 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Fri, 7 Apr 2023 11:51:54 +0300 Subject: [PATCH] internal/weight/nm: handle _ sym type Fixes #68 --- internal/weight/nm/measure.go | 2 +- internal/weight/nm/measure_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/weight/nm/measure.go b/internal/weight/nm/measure.go index 80315e4..0517a21 100644 --- a/internal/weight/nm/measure.go +++ b/internal/weight/nm/measure.go @@ -78,7 +78,7 @@ func parseLine(s string) (*Sym, error) { infoField := "" isSymType := func(s string) bool { - return len(s) == 1 && unicode.IsLetter(rune(s[0])) + return len(s) == 1 && (unicode.IsLetter(rune(s[0])) || s[0] == '_') } switch { diff --git a/internal/weight/nm/measure_test.go b/internal/weight/nm/measure_test.go index 76eab86..b28fa2a 100644 --- a/internal/weight/nm/measure_test.go +++ b/internal/weight/nm/measure_test.go @@ -16,6 +16,7 @@ var validLines = []string{ `1091ca0 192 T type:.eq.[2]interface {}`, `1060160 160 T type:.eq.[2]runtime.Frame`, `1001fa0 256 T type:.eq.[6]internal/cpu.option`, + ` 0 0 _ go.go`, } func TestParseLine(t *testing.T) {