Author: Med Ismail Bennani
Date: 2022-08-09T21:01:37-07:00
New Revision: 355be8cf801603756520cf5d9b4b5eaf9d1b2e77

URL: 
https://github.com/llvm/llvm-project/commit/355be8cf801603756520cf5d9b4b5eaf9d1b2e77
DIFF: 
https://github.com/llvm/llvm-project/commit/355be8cf801603756520cf5d9b4b5eaf9d1b2e77.diff

LOG: [lldb/crashlog] Skip null image dsym fetching on interactive mode

Sometimes, it can happen that a crash report has null images in its list
of used binaries. This manifests like such:

```
    0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
```

When fetching debug symbols to symbolicate the crashlog stackframe,
having null images causes `dsymForUUID` to hang for few seconds.

This patch addresses that by skipping null images from being load by the
scripted process.

rdar://97419487

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

Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com>

Added: 
    

Modified: 
    lldb/examples/python/scripted_process/crashlog_scripted_process.py
    
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/interactive_crashlog/multithread-test.ips

Removed: 
    


################################################################################
diff  --git 
a/lldb/examples/python/scripted_process/crashlog_scripted_process.py 
b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
index 6e7db946a0188..3a5b175dce861 100644
--- a/lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -1,4 +1,4 @@
-import os,json,struct,signal
+import os,json,struct,signal,uuid
 
 from typing import Any, Dict
 
@@ -25,8 +25,11 @@ def load_images(self, images):
             if images:
                 for image in images:
                     if image not in self.loaded_images:
+                        if image.uuid == uuid.UUID(int=0):
+                            continue
                         err = image.add_module(self.target)
                         if err:
+                            # Append to SBCommandReturnObject
                             print(err)
                         else:
                             self.loaded_images.append(image)

diff  --git 
a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/interactive_crashlog/multithread-test.ips
 
b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/interactive_crashlog/multithread-test.ips
index 343b30fb99c16..33153c81f37f0 100644
--- 
a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/interactive_crashlog/multithread-test.ips
+++ 
b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/interactive_crashlog/multithread-test.ips
@@ -472,6 +472,12 @@
       "size": 528384,
       "source": "P",
       "uuid": "b8f1c3ed-9048-34a6-8070-6c18d4ade541"
+    },
+    {
+      "size" : 0,
+      "source" : "A",
+      "base" : 0,
+      "uuid" : "00000000-0000-0000-0000-000000000000"
     }
   ],
   "userID": 501,
@@ -480,4 +486,4 @@
   "vmSummary": "ReadOnly portion of Libraries: Total=762.9M resident=0K(0%) 
swapped_out_or_unallocated=762.9M(100%)\nWritable regions: Total=538.2M 
written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=538.2M(100%)\n\n  
                              VIRTUAL   REGION \nREGION TYPE                    
    SIZE    COUNT (non-coalesced) \n===========                     =======  
======= \nKernel Alloc Once                   32K        1 \nMALLOC             
              145.2M       12 \nMALLOC guard page                   96K        
5 \nMALLOC_NANO (reserved)           384.0M        1         reserved VM 
address space (unallocated)\nSTACK GUARD                       56.0M        3 
\nStack                             9264K        3 \n__AUTH                     
         46K       11 \n__AUTH_CONST                        70K       38 
\n__DATA                             169K       36 \n__DATA_CONST               
        187K       40 \n__DATA_DIRTY                        78K       22 
\n__LINKEDIT                       758.0M        2 \n__OBJC_CONST               
         11K        5 \n__OBJC_RO                         64.7M        1 
\n__OBJC_RW                         1971K        1 \n__TEXT                     
       5076K       42 \ndyld private memory                256K        1 
\nshared memory                       64K        3 \n===========                
     =======  ======= \nTOTAL                              1.4G      227 
\nTOTAL, minus reserved VM space     1.0G      227 \n",
   "vmregioninfo": "0 is not in any region.  Bytes before following region: 
4310450176\n      REGION TYPE                    START - END         [ VSIZE] 
PRT/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  \n      
__TEXT                      100ec4000-100ec8000    [   16K] r-x/r-x SM=COW  
...tithread-test",
   "wakeTime": 214
-}
\ No newline at end of file
+}


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to