Skip to content

Commit

Permalink
[lldb/Bindings] Check that process isn't None before calling is_alive.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JDevlieghere committed Mar 18, 2020
1 parent 68f163d commit a11b330
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lldb/bindings/interface/SBAddress.i
Expand Up @@ -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 ()
Expand Down

0 comments on commit a11b330

Please sign in to comment.