compilecmp icon indicating copy to clipboard operation
compilecmp copied to clipboard

dumpssa: source and destination file path error

Open erifan opened this issue 5 years ago • 7 comments
trafficstars

$ compilecmp -dumpssa "blockGeneric" compilecmp master -> HEAD master (9499a2e108): cmd/dist: detect gohostarch for openbsd/mips64 HEAD (7401657699): cmd/compile: remove desired register information of dead values

file before after Δ % addr2line 4057421 4059517 +2096 +0.052% api 4952451 4952731 +280 +0.006% asm 4888993 4890625 +1632 +0.033% buildid 2617705 2622729 +5024 +0.192% cgo 4521849 4523441 +1592 +0.035% compile 19143451 19141331 -2120 -0.011% cover 4847391 4848407 +1016 +0.021% dist 3473877 3473733 -144 -0.004% doc 3821496 3822480 +984 +0.026% fix 3220587 3220899 +312 +0.010% link 6587504 6587816 +312 +0.005% nm 4000154 4000130 -24 -0.001% objdump 4409449 4410393 +944 +0.021% pack 2398086 2398446 +360 +0.015% pprof 13599060 13601508 +2448 +0.018% test2json 2645148 2645276 +128 +0.005% trace 10355281 10354873 -408 -0.004% vet 6780026 6781722 +1696 +0.025% total 106319929 106336057 +16128 +0.015%

dumping SSA for blockGeneric: cmd.Dir: /home/erifan01/.compilecmp/9499a2e108/src s: dumped SSA to /home/erifan01/.compilecmp/9499a2e108/src/ssa.html c.dir: /home/erifan01/.compilecmp/9499a2e108 relpath: /home/erifan01/.compilecmp/9499a2e108/src/ssa.html src: /home/erifan01/.compilecmp/9499a2e108/src/home/erifan01/.compilecmp/9499a2e108/src/ssa.html prefix: dst: /home/erifan01/.compilecmp/9499a2e108/src/home/erifan01/.compilecmp/9499a2e108/src/blockGeneric.html rename /home/erifan01/.compilecmp/9499a2e108/src/home/erifan01/.compilecmp/9499a2e108/src/ssa.html /home/erifan01/.compilecmp/9499a2e108/src/home/erifan01/.compilecmp/9499a2e108/src/blockGeneric.html: no such file or directory panic: rename /home/erifan01/.compilecmp/9499a2e108/src/home/erifan01/.compilecmp/9499a2e108/src/ssa.html /home/erifan01/.compilecmp/9499a2e108/src/home/erifan01/.compilecmp/9499a2e108/src/blockGeneric.html: no such file or directory

goroutine 1 [running]: log.Panic(0xc000489788, 0x1, 0x1) /home/erifan01/go-in-use/src/log/log.go:351 +0xae main.check(...) /home/erifan01/gopath/src/compilecmp/main.go:393 main.dumpSSA(0x0, 0x0, 0x703a42, 0x6, 0xc000398080, 0xa, 0xc000382540, 0x25, 0xc00021c020, 0x70339f, ...) /home/erifan01/gopath/src/compilecmp/dumpssa.go:75 +0xafb main.comparePlatform(0x0, 0x0, 0x703a42, 0x6, 0x70339f, 0x4) /home/erifan01/gopath/src/compilecmp/main.go:268 +0x94d main.compare(0x703a42, 0x6, 0x70339f, 0x4) /home/erifan01/gopath/src/compilecmp/main.go:196 +0x11a main.main() /home/erifan01/gopath/src/compilecmp/main.go:124 +0x448

I printed out some debugging info, such as c.dir, relpath. Obviously, relpath is not what we expected. It seems cmd.Dir is not working.

erifan avatar Oct 19 '20 10:10 erifan

https://github.com/josharian/compilecmp/blob/c60addb97b3e0a90ac60fa06e62e6eb9f6cee47d/dumpssa.go#L41 This should be StdoutPipe

erifan avatar Oct 20 '20 03:10 erifan

Thanks for digging. It must have changed during this cycle; it once worked.

I guess we need to grab both stderr and stdout and combine them, so it works at least a version back.

Want to send a PR?

josharian avatar Oct 20 '20 03:10 josharian

Oh, sorry, I need to get approval from my company before working on a new project, which is a bit troublesome.

erifan avatar Oct 20 '20 03:10 erifan

Totally understood. Will put it in my queue.

josharian avatar Oct 20 '20 03:10 josharian

Thanks

erifan avatar Oct 20 '20 03:10 erifan

I don't know if there are any relative changes on Go, but this problem still exists.

$ compilecmp -dumpssa '(*Regexp).build:*'

dumping SSA for (*Regexp).build:*:
c.dir: /home/erifan01/.compilecmp/3a63d04d2e
relpath: /home/erifan01/.compilecmp/3a63d04d2e/src/ssa.html
src: /home/erifan01/.compilecmp/3a63d04d2e/src/home/erifan01/.compilecmp/3a63d04d2e/src/ssa.html
dst: /home/erifan01/.compilecmp/3a63d04d2e/src/home/erifan01/.compilecmp/3a63d04d2e/src/_.Regexp_.build_..html
rename /home/erifan01/.compilecmp/3a63d04d2e/src/home/erifan01/.compilecmp/3a63d04d2e/src/ssa.html /home/erifan01/.compilecmp/3a63d04d2e/src/home/erifan01/.compilecmp/3a63d04d2e/src/_.Regexp_.build_..html: no such file or directory
panic: rename /home/erifan01/.compilecmp/3a63d04d2e/src/home/erifan01/.compilecmp/3a63d04d2e/src/ssa.html /home/erifan01/.compilecmp/3a63d04d2e/src/home/erifan01/.compilecmp/3a63d04d2e/src/_.Regexp_.build_..html: no such file or directory

goroutine 1 [running]:
log.Panic(0xc0005b5848, 0x1, 0x1)
        /home/erifan01/go-in-use/src/log/log.go:351 +0xae
main.check(...)
        /home/erifan01/gopath/src/compilecmp/main.go:393
main.dumpSSA(0x0, 0x0, 0x703915, 0x6, 0xc0001a60e0, 0xa, 0xc000196660, 0x25, 0xc000498000, 0x70327c, ...)
        /home/erifan01/gopath/src/compilecmp/dumpssa.go:69 +0x992
main.comparePlatform(0x0, 0x0, 0x703915, 0x6, 0x70327c, 0x4)
        /home/erifan01/gopath/src/compilecmp/main.go:268 +0x94d
main.compare(0x703915, 0x6, 0x70327c, 0x4)
        /home/erifan01/gopath/src/compilecmp/main.go:196 +0x11a
main.main()
        /home/erifan01/gopath/src/compilecmp/main.go:124 +0x448

Seems that the ssa.html file will be always created under /src dirctory ? And the relpath seems to be a full path.

erifan avatar Oct 27 '20 06:10 erifan

Huh. OK, I'll take another look.

josharian avatar Oct 30 '20 03:10 josharian