llcppsymg:symbol debug log
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/goplus/llgo/chore/_xtool/llcppsymg/config"
|
||||
"github.com/goplus/llgo/chore/_xtool/llcppsymg/parse"
|
||||
@@ -29,22 +30,49 @@ import (
|
||||
func main() {
|
||||
cfgFile := "llcppg.cfg"
|
||||
symbFile := "llcppg.symb.json"
|
||||
if len(os.Args) > 1 {
|
||||
cfgFile = os.Args[1]
|
||||
verbose := false
|
||||
readStdin := false
|
||||
|
||||
for i := 1; i < len(os.Args); i++ {
|
||||
arg := os.Args[i]
|
||||
if arg == "-" {
|
||||
readStdin = true
|
||||
} else if arg == "-v" {
|
||||
verbose = true
|
||||
} else if !strings.HasPrefix(arg, "-") {
|
||||
cfgFile = arg
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var data []byte
|
||||
var err error
|
||||
if cfgFile == "-" {
|
||||
if readStdin {
|
||||
data, err = io.ReadAll(os.Stdin)
|
||||
} else {
|
||||
data, err = os.ReadFile(cfgFile)
|
||||
}
|
||||
|
||||
check(err)
|
||||
conf, err := config.GetConf(data)
|
||||
check(err)
|
||||
defer conf.Delete()
|
||||
|
||||
if verbose {
|
||||
symbol.SetDebug(symbol.DbgFlagAll)
|
||||
if readStdin {
|
||||
fmt.Println("Config From Stdin")
|
||||
} else {
|
||||
fmt.Println("Config From File", cfgFile)
|
||||
}
|
||||
fmt.Println("Name:", conf.Name)
|
||||
fmt.Println("CFlags:", conf.CFlags)
|
||||
fmt.Println("Libs:", conf.Libs)
|
||||
fmt.Println("Include:", conf.Include)
|
||||
fmt.Println("TrimPrefixes:", conf.TrimPrefixes)
|
||||
fmt.Println("Cplusplus:", conf.Cplusplus)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Failed to parse config file:", cfgFile)
|
||||
}
|
||||
@@ -53,6 +81,11 @@ func main() {
|
||||
|
||||
filepaths, err := parse.GenHeaderFilePath(conf.CFlags, conf.Include)
|
||||
check(err)
|
||||
|
||||
if verbose {
|
||||
fmt.Println("filepaths", filepaths)
|
||||
}
|
||||
|
||||
headerInfos, err := parse.ParseHeaderFile(filepaths, conf.TrimPrefixes, conf.Cplusplus, false)
|
||||
check(err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user