mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 21:43:40 +00:00
main: add -debug flag that controls debuginfo stripping
Debug information is useful in many case, but in the case of WebAssembly it increases the binary size by a large amount. It also inhibits compression of relocations. Therefore I've made debug information optional and disabled by default. (Debug information is still generated, but stripped from the binary at the link step).
This commit is contained in:
@@ -1019,6 +1019,7 @@ func main() {
|
||||
printStacks := flag.Bool("print-stacks", false, "print stack sizes of goroutines")
|
||||
printAllocsString := flag.String("print-allocs", "", "regular expression of functions for which heap allocations should be printed")
|
||||
printCommands := flag.Bool("x", false, "Print commands")
|
||||
debug := flag.String("debug", "auto", "remove debug information (auto, true, false)")
|
||||
nodebug := flag.Bool("no-debug", false, "disable DWARF debug symbol generation")
|
||||
ocdCommandsString := flag.String("ocd-commands", "", "OpenOCD commands, overriding target spec (can specify multiple separated by commas)")
|
||||
ocdOutput := flag.Bool("ocd-output", false, "print OCD daemon output during debug")
|
||||
@@ -1086,7 +1087,8 @@ func main() {
|
||||
PrintIR: *printIR,
|
||||
DumpSSA: *dumpSSA,
|
||||
VerifyIR: *verifyIR,
|
||||
Debug: !*nodebug,
|
||||
EmitDWARF: !*nodebug,
|
||||
Debug: *debug,
|
||||
PrintSizes: *printSize,
|
||||
PrintStacks: *printStacks,
|
||||
PrintAllocs: printAllocs,
|
||||
@@ -1173,7 +1175,7 @@ func main() {
|
||||
err := Flash(pkgName, *port, options)
|
||||
handleCompilerError(err)
|
||||
} else {
|
||||
if !options.Debug {
|
||||
if !options.EmitDWARF {
|
||||
fmt.Fprintln(os.Stderr, "Debug disabled while running gdb?")
|
||||
usage()
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user