diff --git a/cmd/internal/flags/flags.go b/cmd/internal/flags/flags.go index 9f43a2ed02..69f859a922 100644 --- a/cmd/internal/flags/flags.go +++ b/cmd/internal/flags/flags.go @@ -46,6 +46,7 @@ var SizeFormat string var SizeLevel string var ForceRebuild bool var PrintCommands bool +var PrintDebug bool var OptLevel optlevel.Level type ltoFlag struct { @@ -139,6 +140,7 @@ func AddOptLevelFlags(fs *flag.FlagSet) { func AddBuildFlags(fs *flag.FlagSet) { fs.BoolVar(&ForceRebuild, "a", false, "Force rebuilding of packages that are already up-to-date") fs.BoolVar(&PrintCommands, "x", false, "Print the commands") + fs.BoolVar(&PrintDebug, "debug", false, "Print debug information") AddOptLevelFlags(fs) AddLTOFlag(fs) AddGlobalDCEFlag(fs) @@ -266,6 +268,7 @@ func UpdateConfig(conf *build.Config) error { conf.CompilerHash = compilerhash.Value() conf.Tags = Tags conf.Verbose = Verbose + conf.PrintDebug = PrintDebug conf.PrintCommands = PrintCommands conf.OptLevel = OptLevel conf.Target = Target diff --git a/internal/build/build.go b/internal/build/build.go index 149411815f..4f5295badf 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -143,6 +143,7 @@ type Config struct { AbiMode AbiMode GenExpect bool // only valid for ModeCmpTest Verbose bool + PrintDebug bool PrintCommands bool GenLL bool // generate pkg .ll files CheckLLFiles bool // check .ll files valid @@ -281,7 +282,7 @@ func Do(args []string, conf *Config) ([]Package, error) { cl.EnableExportRename(true) } - verbose := conf.Verbose + verbose := conf.PrintDebug patterns := args tags := "llgo,math_big_pure_go,purego" if conf.AbiMode == cabi.ModeAllFunc { @@ -647,7 +648,7 @@ func (c *context) linker() *clang.Cmd { // shouldPrintCommands reports whether command tracing should be enabled. func (c *context) shouldPrintCommands(verbose bool) bool { - return c.buildConf.PrintCommands || c.buildConf.Verbose || verbose + return c.buildConf.PrintCommands || c.buildConf.PrintDebug || verbose } func (c *context) hasAltPkg(pkgPath string) bool { diff --git a/test/buildcache/test.sh b/test/buildcache/test.sh index 4498ae1fab..592ede6cf9 100755 --- a/test/buildcache/test.sh +++ b/test/buildcache/test.sh @@ -282,7 +282,7 @@ echo "Snapshots directory: $SNAPSHOTS_DIR" echo "Build temp directory: $BUILD_TEMP_DIR" # Run native tests -run_test_suite "native" "llgo build -o $BUILD_TEMP_DIR/buildcache.out -v ." "" +run_test_suite "native" "llgo build -o $BUILD_TEMP_DIR/buildcache.out -debug ." "" # Run WASM tests - always use iwasm from llgo cache directory # Determine cache directory based on platform @@ -311,7 +311,7 @@ if [ -n "$LLGO_IWASM" ] && [ -f "$LLGO_IWASM" ]; then echo "" echo -e "${BLUE}Using iwasm: $LLGO_IWASM${NC}" run_test_suite "wasm" \ - "GOOS=wasip1 GOARCH=wasm llgo build -o $BUILD_TEMP_DIR/buildcache.wasm -tags=nogc -v ." \ + "GOOS=wasip1 GOARCH=wasm llgo build -o $BUILD_TEMP_DIR/buildcache.wasm -tags=nogc -debug ." \ "$BUILD_TEMP_DIR/buildcache.wasm" \ "$LLGO_IWASM --stack-size=819200000 --heap-size=800000000 $BUILD_TEMP_DIR/buildcache.wasm" else @@ -327,7 +327,7 @@ fi echo "" echo -e "${BLUE}Running ESP32-C3 tests...${NC}" run_test_suite "esp32c3" \ - "llgo build -target=esp32c3 -o $BUILD_TEMP_DIR/buildcache.elf -v ." \ + "llgo build -target=esp32c3 -o $BUILD_TEMP_DIR/buildcache.elf -debug ." \ "$BUILD_TEMP_DIR/buildcache.elf" # ===========================================================