[Lldb-commits] [lldb] a11b330 - [lldb/Bindings] Check that process isn't None before calling is_alive.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 17 17:06:18 PDT 2020


Author: Jonas Devlieghere
Date: 2020-03-17T17:06:04-07:00
New Revision: a11b330418819d9cc9c4f0ecd31acdc2e0bbb703

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

LOG: [lldb/Bindings] Check that process isn't None before calling is_alive.

Make sure that `process` is not None before calling is_alive. Otherwise
this might result in an AttributeError: 'NoneType' object has no
attribute 'is_alive'.

Although lldb.process and friends could already be None in the past, for
example after leaving an interactive scripting session, the issue became
more prevalent after `fc1fd6bf9fcfac412b10b4193805ec5de0e8df57`.

I audited the other interface files for usages of target, process,
thread and frame, but this seems the only place where a global is used
from an SB class.

Added: 
    

Modified: 
    lldb/bindings/interface/SBAddress.i

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/interface/SBAddress.i b/lldb/bindings/interface/SBAddress.i
index 4658534d153e..de277607d8f5 100644
--- a/lldb/bindings/interface/SBAddress.i
+++ b/lldb/bindings/interface/SBAddress.i
@@ -154,7 +154,7 @@ public:
 
         def __int__(self):
             '''Convert an address to a load address if there is a process and that process is alive, or to a file address otherwise.'''
-            if process.is_alive:
+            if process and process.is_alive:
                 return self.GetLoadAddress (target)
             else:
                 return self.GetFileAddress ()


        


More information about the lldb-commits mailing list