-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-755] Tool for re-symbolicating fatal stacktraces on Linux. #4479
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
[SR-755] Tool for re-symbolicating fatal stacktraces on Linux. #4479
Conversation
@swift-ci please smoke test |
The failure on Linux was a timeout, doesn't seem to be related to the change I made. Trying to kick off another round of ci. |
@swift-ci please smoke test |
@swift-ci Please test Linux platform |
@swift-ci please smoke test Linux |
@@ -72,7 +72,6 @@ static bool getSymbolNameAddr(llvm::StringRef libraryName, Dl_info dlinfo, | |||
// If the address is unavailable, just use <unavailable> as the symbol |
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-pick: Since you remove the "" string below, I think this comment here might no longer accurate. Could you update this comment as well?
You'll want to run the Python linter on this new code, which contains a few violations. There's a handy utility to run the linter, just run |
|
||
dynlibs = {} | ||
def process_ldd(lddoutput): | ||
global dynlibs |
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.
This line, global dynlibs
, is not needed. Since you define dynlibs
in a global scope above, you are able to reference it throughout this file. This is why you're able to reference it in the process_stack
function below.
Also, I believe the Python linter will raise this issue, but I think that typically Python globals tend to be in UPPER_SNAKE_CASE
.
d252514
to
84cc469
Compare
@modocache re utils/python-lint. I run it + fixed up all the issues it found. Thanks for the suggestion. |
@DougGregor could you kick off another round of tests? I've addressed all the comments, so hopefully this is ready to be merged, pending successful tests. |
|
||
|
||
def main(): | ||
global BINARY |
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.
Instead of storing args.binary
below into this global BINARY
variable, I would suggest passing binary
as an argument into the create_lldb_target()
and process_stack()
functions. I think doing so limits the scope where BINARY
is used and makes the control flow of the program easier to understand.
@modocache All comments addressed. @DougGregor ready for CI again. |
if (foundSymbol) { | ||
static const char *backtraceEntryFormat = "%-4u %-34s 0x%0.16lx %s + %td\n"; | ||
fprintf(stderr, backtraceEntryFormat, index, libraryName.data(), symbolAddr, | ||
symbolName.c_str(), ptrdiff_t(uintptr_t(framePC) - symbolAddr)); |
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.
In C++ code, the line after the linebreak should be aligned with the opening paren. (Here, symbolName
should start in the same column as stderr
.)
The code changes generally LGTM, but it would be good to add some tests. |
@swift-ci Please smoke test |
@swift-ci Please Python lint |
@swift-ci Please smoke test |
@swift-ci Please Python lint |
@swift-ci Please smoke test |
The tests appear to have passed, but in reality the new test was never run. From the logs:
|
@modocache @rintaro There was a bug working out if |
…l-stacktrace-symbolication
@modocache @rintaro Could either one of you kick off Smoke Tests + regular Tests? (I don't have the rights to do that :( ). I've just resolved a superficial merge conflict. |
@DougGregor @gribozavr Any chance either one of you could kick off Smoke + regular tests please? |
@swift-ci Please smoke test |
@swift-ci Please test |
@swift-ci Please smoke test |
@swift-ci Please test |
Tests pass, but now we have a conflict. Argh! @gmilos , can you clear up the conflict so we can merge? |
…l-stacktrace-symbolication
@DougGregor yep, simple conflict in Another round of tests would be very useful. Could you kick them off for me please? Alternatively, if you added me to the Apple group, I could make sure the tests are all green before asking for review/merge. |
@swift-ci please smoke test and merge |
@swift-ci please test |
Build failed |
Build failure is unrelated to the patch:
|
Same failure is present here: @DougGregor would you mind kicking of another set of tests on this PR (both smoke and regular) once the above llvm issue is fixed? |
Build failed |
@swift-ci please smoke test |
Linux PR test passed here: https://ci.swift.org/view/Pull%20Request/job/swift-PR-Linux-smoke-test/1340/ macOS PR test passed here: https://ci.swift.org/view/Pull%20Request/job/swift-PR-osx-smoke-test/1845/ |
Document how symbolicate-linux-fatal tool from swiftlang/swift#4479 can be used to add symbols to backtraces on Linux
Document how symbolicate-linux-fatal tool from swiftlang/swift#4479 can be used to add symbols to backtraces on Linux
[pull] swiftwasm from main
What's in this pull request?
On Linux stack traces are full of symbols. This provides a tool to re-symbolicate such stack trace.
The cause is difference in behaviour of
dladdr
between Linux & Darwin. See SR.Resolved bug number: (SR-755)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
A smoke test on macOS does the following:
device standard libraries are not built.
version of these tests are not run.
A smoke test on Linux does the following:
tests are not run.
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.