forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 339
[lldb] Cherry-picks from ToT #7008
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
Closed
medismailben
wants to merge
10
commits into
swiftlang:swift/release/5.9
from
medismailben:swift/release/5.9
Closed
[lldb] Cherry-picks from ToT #7008
medismailben
wants to merge
10
commits into
swiftlang:swift/release/5.9
from
medismailben:swift/release/5.9
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In 27f27d1, we added a new way to use textual (JSON) object files and symbol files with the interactive crashlog command, using the inlined symbols from the crash report. However, there was a missing piece after successfully adding the textual module to the target, we didn't mark it as available causing the module loading to exit early. This patch addresses that issue by marking the module as available when added successfully to the target. Differential Revision: https://reviews.llvm.org/D149477 Signed-off-by: Med Ismail Bennani <[email protected]>
Sometimes, crash reports come with inlined symbols. These provide the exact stacktrace from the user binary. However, when investigating a crash, it's very likely that the images related to the crashed thread are not available on the debugging user system or that the versions don't match. This causes interactive crashlog to show a degraded backtrace in lldb. This patch aims to address that issue, by parsing the inlined symbols from the crash report and load them into lldb's target. This patch is a follow-up to 27f27d1, focusing on inlined symbols loading from legacy (non-json) crash reports. To do so, it updates the stack frame regular expression to make the capture groups more granular, to be able to extract the symbol name, the offset and the source location if available, while making it more maintainable. So now, when parsing the crash report, we build a data structure containing all the symbol information for each stackframe. Then, after launching the scripted process for interactive mode, we write a JSON symbol file for each module, only containing the symbols that it contains. Finally, we load the json symbol file into lldb, before showing the user the process status and backtrace. rdar://97345586 Differential Revision: https://reviews.llvm.org/D146765 Signed-off-by: Med Ismail Bennani <[email protected]>
This patch should fix an issue when parsing the process pid and setting it in the scripted process. It can happen that the `crashlog.process_id` attribute is sometimes parsed as a string. That would cause the scripted process to pick the default value (0). To address that, this patch makes sure that the parsed attributed is converted to the integer type before passing it to the scripted process. Differential Revision: https://reviews.llvm.org/D151002 Signed-off-by: Med Ismail Bennani <[email protected]>
This patch fixes the log commands by replacing the LLDB_LOG macro by the LLDB_LOGF macro. This is necessary in order to format argument with printf. Signed-off-by: Med Ismail Bennani <[email protected]>
This patch adds support to eStopReasonTrace to Scripted Threads. This is necessary when using a Scrited Process with a Scripted Thread Plan to report a special thread stop reason to the thread plan. rdar://109425542 Differential Revision: https://reviews.llvm.org/D151043 Signed-off-by: Med Ismail Bennani <[email protected]>
This patch changes the way we generate the ObjectFileJSON files containing the inlined symbols from the crash report to remove the tempfile prefix from the object file name. To do so, instead of creating a new tempfile for each module, we create a temporary directory that contains each module object file with the same name as the module. This makes the backtraces only contain the module name without the temfile prefix which makes it look like a regular stackframe. Differential Revision: https://reviews.llvm.org/D151045 Signed-off-by: Med Ismail Bennani <[email protected]>
Following abba5de, some tests started failing on green-dragon: https://green.lab.llvm.org/green/job/lldb-cmake/55460/console Looking at the backtrace, there seems to be a racing issue when deleting the temporary directory containing all the JSON object files: ``` Traceback (most recent call last): File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1115, in __call__ SymbolicateCrashLogs(debugger, shlex.split(command), result) File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1457, in SymbolicateCrashLogs SymbolicateCrashLog(crash_log, options) File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1158, in SymbolicateCrashLog with tempfile.TemporaryDirectory() as obj_dir: File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 869, in __exit__ self.cleanup() File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 873, in cleanup self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors) File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 731, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 729, in rmtree os.rmdir(path) OSError: [Errno 66] Directory not empty: '/var/folders/09/r4vw4v8n5kb67jl66zvlbljw0000gn/T/tmp6qfifxk7' ``` This patch should fix that issue since it won't delete the object file directory until we're sure that the modules adding tasks completed. Signed-off-by: Med Ismail Bennani <[email protected]>
This patch changes the way we load a crash report into a scripted process by creating a empty target. To do so, it parses the architecture information from the report (for both the legacy and json format) and uses that to create a target that doesn't have any executable, like what we do when attaching to a process. For the legacy format, we mostly rely on the `Code Type` line, since the architure is an optional field on the `Binary Images` sections. However for the json format, we first try to get the architecture while parsing the image dictionary if we couldn't find it, we try to infer it using the "flavor" key when parsing the frame's registers. If the architecture is still not set after parsing the report, we raise an exception. rdar://107850263 Differential Revision: https://reviews.llvm.org/D151849 Differential Signed-off-by: Med Ismail Bennani <[email protected]>
@swift-ci test |
Signed-off-by: Med Ismail Bennani <[email protected]>
If we use a variable watchpoint with a condition using a scope variable, if we go out-of-scope, the watpoint remains active which can the expression evaluator to fail to parse the watchpoint condition (because of the missing varible bindings). This was discovered after `watchpoint_callback.test` started failing on the green dragon bot. This patch should address that issue by setting an internal breakpoint on the return addresss of the current frame when creating a variable watchpoint. The breakpoint has a callback that will disable the watchpoint if the the breakpoint execution context matches the watchpoint execution context. This is only enabled for local variables. This patch also re-enables the failing test following e108638. rdar://109574319 Differential Revision: https://reviews.llvm.org/D151366 Signed-off-by: Med Ismail Bennani <[email protected]>
4329b94
to
083181d
Compare
@swift-ci test |
@swift-ci test windows platform |
I discussed this offline with @medismailben and he'll split up the PR into multiple PRs that are easier to review. All the changes here are related, but there's to much too meaningfully decide whether this is safe to go in or not. |
@JDevlieghere @adrian-prantl I've tried to split this across #7009 #7010 #7012 #7014 & #7015 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch contains a bunch of fix and improvements cherry-picked from the top-of-tree llvm repo, namely:
This PR also contains some python re-formatting patches.