]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.cc] cmd/asm: set the flags to production settings (turn off debug)
authorRob Pike <r@golang.org>
Wed, 28 Jan 2015 23:41:12 +0000 (15:41 -0800)
committerRob Pike <r@golang.org>
Thu, 29 Jan 2015 19:08:26 +0000 (19:08 +0000)
Set -S to false and add -debug to control the other debugging print.

Change-Id: I864866c3d264a33e6dd0ce12a86a050a5fe0f875
Reviewed-on: https://go-review.googlesource.com/3453
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/asm/internal/asm/asm.go
src/cmd/asm/internal/flags/flags.go
src/cmd/asm/main.go

index dfb7ad19cce0fef195b5c89bb0a786a2d0834d08..63adef271be2abe3ff45360ec50c7bc6134ba009 100644 (file)
@@ -11,6 +11,7 @@ import (
 
        "cmd/asm/internal/addr"
        "cmd/asm/internal/arch"
+       "cmd/asm/internal/flags"
        "cmd/asm/internal/lex"
        "cmd/internal/obj"
 )
@@ -140,7 +141,9 @@ func (p *Parser) append(prog *obj.Prog, doLabel bool) {
                p.pendingLabels = p.pendingLabels[0:0]
        }
        prog.Pc = int64(p.pc)
-       fmt.Println(p.histLineNum, prog)
+       if *flags.Debug {
+               fmt.Println(p.histLineNum, prog)
+       }
 }
 
 // asmText assembles a TEXT pseudo-op.
index 61cd860cd16f22b0c2c3d449a32377d4da1444fa..9640f994d7cb9a7f6705dd0e899f66f9896974ac 100644 (file)
@@ -14,8 +14,9 @@ import (
 )
 
 var (
-       OutputFile = flag.String("o", "", "output file; default foo.6 for /a/b/c/foo.s on arm64 (unused TODO)")
-       PrintOut   = flag.Bool("S", true, "print assembly and machine code") // TODO: set to false
+       Debug      = flag.Bool("debug", false, "dump instructions as they are parsed")
+       OutputFile = flag.String("o", "", "output file; default foo.6 for /a/b/c/foo.s on amd64")
+       PrintOut   = flag.Bool("S", false, "print assembly and machine code")
        TrimPath   = flag.String("trimpath", "", "remove prefix from recorded source file paths (unused TODO)")
 )
 
index 3c02d4eebd5e110126c2c44f90cb34c0a5e25123..937b1921781be6341daf012c58af163a7f37e196 100644 (file)
@@ -54,7 +54,7 @@ func main() {
        var ok bool
        pList.Firstpc, ok = parser.Parse()
        if !ok {
-               log.Print("FAIL TODO")
+               log.Fatalf("asm: assembly of %s failed", flag.Arg(0))
                os.Exit(1)
        }
        obj.Writeobjdirect(ctxt, output)