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
49 changes: 47 additions & 2 deletions _xtool/llcppsigfetch/dbg/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ type dbgFlags = int
var flags dbgFlags

const (
DbgParse dbgFlags = 1 << iota
DbgFlagAll = DbgParse
DbgParse dbgFlags = 1 << iota
DbgVisitTop
DbgProcess
DbgGetCurFile
DbgMacro
DbgFileType
DbgFlagAll = 0
)

func SetDebugParse() {
Expand All @@ -20,3 +25,43 @@ func GetDebugParse() bool {
func SetDebugAll() {
flags = DbgFlagAll
}

func SetDebugVisitTop() {
flags |= DbgVisitTop
}

func GetDebugVisitTop() bool {
return flags&DbgVisitTop != 0
}

func SetDebugProcess() {
flags |= DbgProcess
}

func GetDebugProcess() bool {
return flags&DbgProcess != 0
}

func SetDebugGetCurFile() {
flags |= DbgGetCurFile
}

func GetDebugGetCurFile() bool {
return flags&DbgGetCurFile != 0
}

func SetDebugMacro() {
flags |= DbgMacro
}

func GetDebugMacro() bool {
return flags&DbgMacro != 0
}

func SetDebugFileType() {
flags |= DbgFileType
}

func GetDebugFileType() bool {
return flags&DbgFileType != 0
}
129 changes: 129 additions & 0 deletions _xtool/llcppsigfetch/dbg/debug_test.go
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)
}
})
}
}
3 changes: 0 additions & 3 deletions _xtool/llcppsigfetch/llcppsigfetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ func main() {
printUsage()
return
}
if ags.VerboseSigfetchParse {
dbg.SetDebugParse()
}
if ags.Verbose {
dbg.SetDebugAll()
}
Expand Down
16 changes: 4 additions & 12 deletions _xtool/llcppsymg/args/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import (
)

type Args struct {
Help bool
Verbose bool
VerboseSigfetchParse bool //-vsp llcppsigfetch parse.go
VerboseParseIsMethod bool //-vpim
UseStdin bool
CfgFile string
Help bool
Verbose bool
UseStdin bool
CfgFile string
}

func ParseArgs(args []string, defaultCfgFile string, swflags map[string]bool) (*Args, []string) {
Expand All @@ -27,12 +25,6 @@ func ParseArgs(args []string, defaultCfgFile string, swflags map[string]bool) (*
case "-v":
result.Verbose = true
continue
case "-vpim":
result.VerboseParseIsMethod = true
continue
case "-vsp":
result.VerboseSigfetchParse = true
continue
case "-":
result.UseStdin = true
continue
Expand Down
51 changes: 50 additions & 1 deletion _xtool/llcppsymg/dbg/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ 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 = 0
)

func SetDebugAll() {
flags = DbgFlagAll
}

func SetDebugSymbol() {
flags |= DbgSymbol
}
Expand All @@ -25,3 +34,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
}
Loading
Loading