[Lldb-commits] [lldb] 3e8c1c4 - [lldb/crashlog] Fix frame parser regex for when there is no source info

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 4 22:06:30 PDT 2022


Author: Med Ismail Bennani
Date: 2022-11-04T22:05:58-07:00
New Revision: 3e8c1c4fc48a286dd546899a7374dce680633d93

URL: https://github.com/llvm/llvm-project/commit/3e8c1c4fc48a286dd546899a7374dce680633d93
DIFF: https://github.com/llvm/llvm-project/commit/3e8c1c4fc48a286dd546899a7374dce680633d93.diff

LOG: [lldb/crashlog] Fix frame parser regex for when there is no source info

It can happen that the originator of a crash report doesn't have access
to certain images. When that's the case, ReportCrash won't show the
source info in the crash report stack frames, but only the stack address
and image name.

This patch fixes a bug in the crashlog stackframe parser regular
expression to optionally match the source info group.

rdar://101934135

Differential Revision: https://reviews.llvm.org/D137466

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/examples/python/crashlog.py
    lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 47250f3b350f1..c3a450ccb14bd 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -645,7 +645,7 @@ class TextCrashLogParser(CrashLogParser):
                              r'(.+?)\s+'               # img_name
                              r'(?:' +version+ r'\s+)?' # img_version
                              r'(0x[0-9a-fA-F]{4,})'    # addr (4 chars or more)
-                             r' +(.*)'                 # offs
+                             r'(?: +(.*))?'            # offs
                             )
     null_frame_regex = re.compile(r'^\d+\s+\?\?\?\s+0{4,} +')
     image_regex_uuid = re.compile(r'(0x[0-9a-fA-F]+)'          # img_lo

diff  --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
index 16a95586a13b4..4361ed5020028 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
@@ -29,7 +29,7 @@ Terminating Process:   exc handler [21606]
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   a.out                         	@foo@ foo + 16 (test.c:3)
-1   a.out                         	@bar@ bar + 9 (test.c:6)
+1   a.out                         	@bar@
 2   a.out                         	@main@ main + 20 (test.c:8)
 3   libdyld.dylib                 	0x1000000 start + 1
 


        


More information about the lldb-commits mailing list