[Lldb-commits] [PATCH] D131038: [lldb/crashlog] Skip null image dsym fetching on interactive mode

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 2 17:43:26 PDT 2022


mib created this revision.
mib added a reviewer: JDevlieghere.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131038

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


Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/skipped_status_interactive_crashlog.test
===================================================================
--- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/skipped_status_interactive_crashlog.test
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/skipped_status_interactive_crashlog.test
@@ -7,6 +7,7 @@
 # RUN: -o 'command source -s 0 %s' 2>&1 | FileCheck %s
 
 # CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands
+# CHECK: Note: Skipping null image
 
 process status
 # CHECK: Process 22511 stopped
Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/interactive_crashlog/multithread-test.ips
===================================================================
--- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/interactive_crashlog/multithread-test.ips
+++ 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
+}
Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py
===================================================================
--- lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ 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,12 @@
             if images:
                 for image in images:
                     if image not in self.loaded_images:
+                        if image.uuid == uuid.UUID(int=0):
+                            print(f"Note: Skipping null image")
+                            continue
                         err = image.add_module(self.target)
                         if err:
+                            # Append to SBCommandReturnObject
                             print(err)
                         else:
                             self.loaded_images.append(image)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131038.449498.patch
Type: text/x-patch
Size: 4182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220803/7634f207/attachment-0001.bin>


More information about the lldb-commits mailing list