-
Notifications
You must be signed in to change notification settings - Fork 11
add dbg flag for llcppsigfetch, llcppsymg, gogensig to control log #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| package dbg | ||
|
|
||
| import "testing" | ||
|
|
||
| func TestSetDebugParse(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugParse", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugParse() | ||
| if !GetDebugParse() { | ||
| t.Errorf("GetDebugParse() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugAll(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugAll", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugAll() | ||
| if flags != DbgFlagAll { | ||
| t.Errorf("flags = %v, want %v", flags, DbgFlagAll) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugVisitTop(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugVisitTop", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugVisitTop() | ||
| if !GetDebugVisitTop() { | ||
| t.Errorf("GetDebugVisitTop() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugProcess(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugProcess", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugProcess() | ||
| if !GetDebugProcess() { | ||
| t.Errorf("GetDebugProcess() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugGetCurFile(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugGetCurFile", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugGetCurFile() | ||
| if !GetDebugGetCurFile() { | ||
| t.Errorf("GetDebugGetCurFile() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugMacro(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugMacro", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugMacro() | ||
| if !GetDebugMacro() { | ||
| t.Errorf("GetDebugMacro() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugFileType(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugFileType", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugFileType() | ||
| if !GetDebugFileType() { | ||
| t.Errorf("GetDebugFileType() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,12 @@ var flags dbgFlags | |
| const ( | ||
| DbgSymbol dbgFlags = 1 << iota | ||
| DbgParseIsMethod //print parse.go isMethod debug log info | ||
| DbgFlagAll = DbgSymbol | DbgParseIsMethod | ||
| DbgEditSymMap //print user edit sym map info | ||
| DbgVisitTop //print visitTop | ||
| DbgCollectFuncInfo | ||
| DbgNewSymbol | ||
| DbgFileType | ||
| DbgFlagAll = DbgSymbol | DbgParseIsMethod | ||
|
||
| ) | ||
|
|
||
| func SetDebugSymbol() { | ||
|
|
@@ -25,3 +30,43 @@ func SetDebugParseIsMethod() { | |
| func GetDebugParseIsMethod() bool { | ||
| return flags&DbgParseIsMethod != 0 | ||
| } | ||
|
|
||
| func SetDebugEditSymMap() { | ||
| flags |= DbgEditSymMap | ||
| } | ||
|
|
||
| func GetDebugEditSymMap() bool { | ||
| return flags&DbgEditSymMap != 0 | ||
| } | ||
|
|
||
| func SetDebugVisitTop() { | ||
| flags |= DbgVisitTop | ||
| } | ||
|
|
||
| func GetDebugVisitTop() bool { | ||
| return flags&DbgVisitTop != 0 | ||
| } | ||
|
|
||
| func SetDebugCollectFuncInfo() { | ||
| flags |= DbgCollectFuncInfo | ||
| } | ||
|
|
||
| func GetDebugCollectFuncInfo() bool { | ||
| return flags&DbgCollectFuncInfo != 0 | ||
| } | ||
|
|
||
| func SetDebugNewSymbol() { | ||
| flags |= DbgNewSymbol | ||
| } | ||
|
|
||
| func GetDebugNewSymbol() bool { | ||
| return flags&DbgNewSymbol != 0 | ||
| } | ||
|
|
||
| func SetDebugFileType() { | ||
| flags |= DbgFileType | ||
| } | ||
|
|
||
| func GetDebugFileType() bool { | ||
| return flags&DbgFileType != 0 | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| package dbg | ||
|
|
||
| import ( | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestSetDebugSymbol(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugSymbol", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugSymbol() | ||
| if !GetDebugSymbol() { | ||
| t.Errorf("GetDebugSymbol() = got %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugParseIsMethod(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugParseIsMethod", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugParseIsMethod() | ||
| if !GetDebugParseIsMethod() { | ||
| t.Errorf("GetDebugParseIsMethod() = got %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugEditSymMap(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugEditSymMap", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugEditSymMap() | ||
| if !GetDebugEditSymMap() { | ||
| t.Errorf("GetDebugEditSymMap() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugVisitTop(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| "TestSetDebugVisitTop", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugVisitTop() | ||
| if !GetDebugVisitTop() { | ||
| t.Errorf("GetDebugVisitTop() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugCollectFuncInfo(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugCollectFuncInfo", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugCollectFuncInfo() | ||
| if !GetDebugCollectFuncInfo() { | ||
| t.Errorf("GetDebugCollectFuncInfo() got = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugNewSymbol(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugNewSymbol", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugNewSymbol() | ||
| if !GetDebugNewSymbol() { | ||
| t.Errorf("GetDebugNewSymbol() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSetDebugFileType(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| }{ | ||
| { | ||
| name: "TestSetDebugFileType", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| SetDebugFileType() | ||
| if !GetDebugFileType() { | ||
| t.Errorf("GetDebugFileType() = %v, want %v", false, true) | ||
| } | ||
| }) | ||
| } | ||
| } |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
相同的问题需要处理~ #245 (comment)