-
Notifications
You must be signed in to change notification settings - Fork 607
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
use simplified demangled symbol names in disassembly report #449
Conversation
Codecov Report
@@ Coverage Diff @@
## master #449 +/- ##
==========================================
+ Coverage 67.05% 67.80% +0.74%
==========================================
Files 37 37
Lines 7629 7637 +8
==========================================
+ Hits 5116 5178 +62
+ Misses 2105 2047 -58
- Partials 408 412 +4
Continue to review full report at Codecov.
|
@kalyanac Add a test? The code change is small but I think we should still cover it. |
sync to upstream
When a binary provided to pprof has no symbols, it is not recognized as a binary. This happens because the err value is only checked against 'nil'. This PR fixes this issue by checking the err value against elf.ErrNoSymbols in addition to nil.
Recognize an executable without symbols
sorry for the delay, added a test as requested |
da402b4
to
a7e4c1a
Compare
the failures are on OS X with objdump. I will take a look at modifying the test for OS X. |
334f31d
to
316bbcc
Compare
Mac tests using XCode 8.3 are all failing because
Since XCode 8.3 is pretty old, can we drop support for it? |
919d375
to
f77c42f
Compare
Added code to look for and determine objdump version before starting the test.
output with objdump version < 9.0
output when objdump not found or version cannot be determined
|
c57d9b9
to
8a1a78d
Compare
fmt.Fprintf(w, "ROUTINE ======================== %s\n", demangle.Filter(s.sym.Name[0][1:], options...)) | ||
} else { | ||
fmt.Fprintf(w, "ROUTINE ======================== %s\n", demangle.Filter(s.sym.Name[0], options...)) | ||
} | ||
for _, name := range s.sym.Name[1:] { | ||
fmt.Fprintf(w, " AKA ======================== %s\n", name) |
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.
Should we demangle these ones too?
fmt.Fprintf(w, "ROUTINE ======================== %s\n", s.sym.Name[0]) | ||
if strings.HasPrefix(s.sym.Name[0], "__Z") { | ||
// Workaround to handle double leading underscores on Mac | ||
// which are not properly handled by the demangle.Filter |
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.
Could we open an issue against the demangle package for this?
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.
@@ -413,6 +414,9 @@ func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) e | |||
} | |||
} | |||
|
|||
// demangle symbols by default for disassembly report | |||
options := []demangle.Option{demangle.NoParams, demangle.NoTemplateParams} |
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.
I would've preferred to have a way to control this, (eg with symbolize=demangle=xxx). Sometimes having the mangled name is useful
@@ -163,6 +163,14 @@ func (bu *Binutils) Disasm(file string, start, end uint64) ([]plugin.Inst, error | |||
fmt.Sprintf("--start-address=%#x", start), | |||
fmt.Sprintf("--stop-address=%#x", end), | |||
file) | |||
|
|||
if runtime.GOOS == "darwin" { |
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.
So without this disasm doesn't work on Mac at all? If that's the case perhaps we should put this on its own PR
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.
…nto disasm_demangle
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@kalyanac -- Does it make sense to try to get this PR merged in still? |
No, it should be addressed by #534 |
In the current disassembly report, not all symbols are demangled. This results in readability challenges with examining the report.
This PR demangles all symbol names while generating the disassembly report. By default, demangling of function and template parameters is disabled to generate a simplified symbol name.
If a symbol cannot be demangled, it is printed as is.