Skip to content

[lldb/crashlog] Fix breaking changes in textual report format #83861

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

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

medismailben
Copy link
Member

This patch should address some register parsing issue in the legacy report format.

rdar://107210149

@llvmbot llvmbot added the lldb label Mar 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 4, 2024

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

Changes

This patch should address some register parsing issue in the legacy report format.

rdar://107210149


Full diff: https://github.com/llvm/llvm-project/pull/83861.diff

1 Files Affected:

  • (modified) lldb/examples/python/crashlog.py (+7-4)
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 9e4f94264037ae..c992348b24be17 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -849,10 +849,10 @@ def parse_errors(self, json_data):
 
 class TextCrashLogParser(CrashLogParser):
     parent_process_regex = re.compile(r"^Parent Process:\s*(.*)\[(\d+)\]")
-    thread_state_regex = re.compile(r"^Thread \d+ crashed with")
+    thread_state_regex = re.compile(r"^Thread (\d+ crashed with|State)")
     thread_instrs_regex = re.compile(r"^Thread \d+ instruction stream")
-    thread_regex = re.compile(r"^Thread (\d+).*:")
-    app_backtrace_regex = re.compile(r"^Application Specific Backtrace (\d+).*:")
+    thread_regex = re.compile(r"^Thread (\d+).*")
+    app_backtrace_regex = re.compile(r"^Application Specific Backtrace (\d+).*")
 
     class VersionRegex:
         version = r"\(.+\)|(?:arm|x86_)[0-9a-z]+"
@@ -1081,7 +1081,10 @@ def parse_normal(self, line):
             if thread_state_match:
                 self.app_specific_backtrace = False
                 thread_state_match = self.thread_regex.search(line)
-                thread_idx = int(thread_state_match.group(1))
+                if thread_state_match:
+                    thread_idx = int(thread_state_match.group(1))
+                else:
+                    thread_idx = self.crashlog.crashed_thread_idx
                 self.parse_mode = self.CrashLogParseMode.THREGS
                 self.thread = self.crashlog.threads[thread_idx]
                 return

@JDevlieghere
Copy link
Member

Can you add/modify a test?

This patch should address some register parsing issue in the legacy
report format.

rdar://107210149
rdar://119998761

Signed-off-by: Med Ismail Bennani <[email protected]>
Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@medismailben medismailben merged commit 5000e4c into llvm:main Mar 4, 2024
medismailben added a commit to medismailben/llvm-project that referenced this pull request Mar 4, 2024
…3861)

This patch should address some register parsing issue in the legacy
report format.

rdar://107210149

Signed-off-by: Med Ismail Bennani <[email protected]>
medismailben added a commit to swiftlang/llvm-project that referenced this pull request Mar 5, 2024
[lldb/crashlog] Fix breaking changes in textual report format (llvm#83861)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants