x86/xeddata: trim leading space in parsing The new version of XED data file contains some comment lines with a leading space, e.g. " # EOSZ=2 not64". The current parser doesn't recognize it. Trim the leading space. Change-Id: Ia5aa244aece7a1cee2d7842d69c60c9d5335dcce Reviewed-on: https://go-review.googlesource.com/c/arch/+/655435 Reviewed-by: Austin Clements <austin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/x86/xeddata/reader.go b/x86/xeddata/reader.go index fc8aa94..cd23510 100644 --- a/x86/xeddata/reader.go +++ b/x86/xeddata/reader.go
@@ -113,6 +113,7 @@ ) for _, l := range lines { + l = strings.TrimLeft(l, " ") if l[0] == '#' { // Skip comment lines. continue }
diff --git a/x86/xeddata/testdata/xed_objects.txt b/x86/xeddata/testdata/xed_objects.txt index 9d0c52e..c252acf 100644 --- a/x86/xeddata/testdata/xed_objects.txt +++ b/x86/xeddata/testdata/xed_objects.txt
@@ -13,6 +13,7 @@ # { # ICLASS : ADD # } + # comment with leading space ==== []