-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Intel syntax in the assembly reports #520
Conversation
Can you include test outputs? |
internal/binutils/binutils.go
Outdated
cmd = exec.Command(b.objdump, "-x86-asm-syntax=intel", "-d", "-C", "--no-show-raw-insn", "-l", | ||
fmt.Sprintf("--start-address=%#x", start), | ||
fmt.Sprintf("--stop-address=%#x", end), | ||
file) | ||
} else { | ||
cmd = exec.Command(b.objdump, "-M", "intel", "-d", "-C", "--no-show-raw-insn", "-l", | ||
fmt.Sprintf("--start-address=%#x", start), | ||
fmt.Sprintf("--stop-address=%#x", end), | ||
file) | ||
} | ||
} else { | ||
cmd = exec.Command(b.objdump, "-d", "-C", "--no-show-raw-insn", "-l", | ||
fmt.Sprintf("--start-address=%#x", start), | ||
fmt.Sprintf("--stop-address=%#x", end), | ||
file) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we modify the arguments instead of duplicating the whole call? Make them an array, massage as needed, use ellipsis syntax to invoke exec.Command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This PR seems to contain unrelated commits. |
…y non-bool option." This reverts commit a9ea908.
Should now be reverted. |
internal/report/report.go
Outdated
@@ -79,6 +79,8 @@ type Options struct { | |||
Symbol *regexp.Regexp // Symbols to include on disassembly report. | |||
SourcePath string // Search path for source files. | |||
TrimPath string // Paths to trim from source file paths. | |||
|
|||
IntelSyntax bool // Whether or not to print assembly in Intel syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing trailing full stop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Done. |
Codecov Report
@@ Coverage Diff @@
## master #520 +/- ##
==========================================
+ Coverage 67.06% 67.07% +0.01%
==========================================
Files 37 37
Lines 7611 7623 +12
==========================================
+ Hits 5104 5113 +9
- Misses 2103 2104 +1
- Partials 404 406 +2
Continue to review full report at Codecov.
|
I am referring to the file path argument (it's the only positional one: |
I see. Right now, I am actually inserting the "intel flags" at the beginning of the |
Ah, I missed that, sorry. |
internal/binutils/binutils.go
Outdated
b := bu.get() | ||
cmd := exec.Command(b.objdump, "-d", "-C", "--no-show-raw-insn", "-l", | ||
var cmd *exec.Cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this var, and use "cmd :=" below, as prior to to this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
internal/binutils/binutils.go
Outdated
|
||
if intelSyntax { | ||
if runtime.GOOS == "darwin" { | ||
args = append([]string{"-x86-asm-syntax=intel"}, args...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I personally would append this flag at the end, and move appending file to after this code. It doesn't really matter much in this case, but appending "args..." is O(N), unnecessarily. Again, this doesn't really matter here since the list is fixed len and tiny. So feel free to leave this as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense. Now changed.
Updated cmd/pprof.objTool.Disasm to accept an additional bool param introduced in google/pprof#520 to support intel syntax in the assembly report. Returns an error if the intelSyntax param is set. We use src/cmd/internal/objfile to disassemble and print assembly so I am not sure if it is relevant, and if so, how. Fixes #38802 Updates #36905 Change-Id: Iae2b4322404f232196705f05210f00e2495588d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/248499 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Bump from 20191205061153 => 20201109224723 My personal interest is to pull in google/pprof#564, which adds support for displaying names with `"` in them, which julia functions sometimes have (e.g. `var"#foo#23"`) Includes: - google/pprof#564 - google/pprof#575 - google/pprof#574 - google/pprof#571 - google/pprof#572 - google/pprof#570 - google/pprof#562 - google/pprof#561 - google/pprof#565 - google/pprof#560 - google/pprof#563 - google/pprof#557 - google/pprof#554 - google/pprof#552 - google/pprof#545 - google/pprof#549 - google/pprof#547 - google/pprof#541 - google/pprof#534 - google/pprof#542 - google/pprof#535 - google/pprof#531 - google/pprof#530 - google/pprof#528 - google/pprof#522 - google/pprof#525 - google/pprof#527 - google/pprof#519 - google/pprof#520 - google/pprof#517 - google/pprof#518 - google/pprof#514 - google/pprof#513 - google/pprof#510 - google/pprof#508 - google/pprof#506 - google/pprof#509 - google/pprof#504
* Update pprof to latest revision Bump from 20191205061153 => 20201109224723 My personal interest is to pull in google/pprof#564, which adds support for displaying names with `"` in them, which julia functions sometimes have (e.g. `var"#foo#23"`) Includes: - google/pprof#564 - google/pprof#575 - google/pprof#574 - google/pprof#571 - google/pprof#572 - google/pprof#570 - google/pprof#562 - google/pprof#561 - google/pprof#565 - google/pprof#560 - google/pprof#563 - google/pprof#557 - google/pprof#554 - google/pprof#552 - google/pprof#545 - google/pprof#549 - google/pprof#547 - google/pprof#541 - google/pprof#534 - google/pprof#542 - google/pprof#535 - google/pprof#531 - google/pprof#530 - google/pprof#528 - google/pprof#522 - google/pprof#525 - google/pprof#527 - google/pprof#519 - google/pprof#520 - google/pprof#517 - google/pprof#518 - google/pprof#514 - google/pprof#513 - google/pprof#510 - google/pprof#508 - google/pprof#506 - google/pprof#509 - google/pprof#504 * Update P/pprof/build_tarballs.jl - use a real version number Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com> * Remove now unused `timestamp` * [pprof] Use `GitSource` Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>
Add support for output assembly in Intel Syntax.
Fixes: #400
Add an option to support Intel syntax in the assembly report, which is used in both
disasm
andweblist
formats.Tested on both Mac OS and Linux.