[Lldb-commits] [lldb] [lldb/crashlog] Enforce image loading policy (PR #91109)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Sat May 4 23:53:08 PDT 2024


https://github.com/medismailben created https://github.com/llvm/llvm-project/pull/91109

Starting `27f27d1`, we changed the image loading logic to conform to the various options (`-a|--load-all` & `-c|--crashed-only`) and set the `resolve` attribute of the matching images.

Then, we would try to load all those images concurrently. However, the `symbolicator.Image.add_module` method didn't check the `resolve` attribute to skip unwanted images, causing all images to be loaded in the target everytime. This matches the `-a|--load-all` option behaviour but it can cause lldb to load thousands of images, which can take a very long time if the images are downloaded over the network.

This patch fixes that issue by checking the `Image.resolve` attribute to conform to the user selection, and reinstates the expected default behaviour, by only loading the crashed thread images and skipping all the others.

rdar://123694062

>From 4284d687ebc79320f6546d7f5dcaa528bfd5e2b0 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <ismail at bennani.ma>
Date: Sat, 4 May 2024 23:52:27 -0700
Subject: [PATCH] [lldb/crashlog] Enforce image loading policy

Starting `27f27d1`, we changed the image loading logic to conform to the
various options (`-a|--load-all` & `-c|--crashed-only`) and set the `resolve`
attribute of the matching images.

Then, we would try to load all those images concurrently. However, the
`symbolicator.Image.add_module` method didn't check the `resolve`
attribute to skip unwanted images, causing all images to be loaded in
the target everytime. This matches the `-a|--load-all` option behaviour
but it can cause lldb to load thousands of images, which can take a very
long time if the images are downloaded over the network.

This patch fixes that issue by checking the `Image.resolve` attribute to
conform to the user selection, and reinstates the expected default behaviour,
by only loading the crashed thread images and skipping all the others.

rdar://123694062

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
---
 lldb/examples/python/symbolication.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lldb/examples/python/symbolication.py b/lldb/examples/python/symbolication.py
index f6dcc8b9a79437..f247ebf3da733a 100755
--- a/lldb/examples/python/symbolication.py
+++ b/lldb/examples/python/symbolication.py
@@ -399,6 +399,12 @@ def add_module(self, target, obj_dir=None):
         if not self.path and self.uuid == uuid.UUID(int=0):
             return "error: invalid image"
 
+        if not self.resolve:
+            # Since this method get called concurrently on every crashlog image,
+            # we should only add the images marked to be resolved and skip the
+            # others.
+            return None
+
         if target:
             # Try and find using UUID only first so that paths need not match
             # up



More information about the lldb-commits mailing list