Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'strip' #197

Closed
nateozem opened this issue May 4, 2017 · 9 comments
Closed

AttributeError: 'NoneType' object has no attribute 'strip' #197

nateozem opened this issue May 4, 2017 · 9 comments

Comments

@nateozem
Copy link
Contributor

nateozem commented May 4, 2017

Using lldb v360.99.0 (v4.0.0.1), I'll get the following error:

$ lldb 
An error occurred while loading Voltron:

Traceback (most recent call last):
  File "./lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/entry.py", line 99, in <module>
	voltron.command = plugin.command_class(*args)
  File "./lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/plugins/debugger/dbg_lldb.py", line 549, in __init__
	self.adaptor.command("script import voltron")
  File "./lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/dbg.py", line 82, in inner
	raise e
AttributeError: 'NoneType' object has no attribute 'strip'

Please ensure Voltron is installed correctly per the documentation: https://github.com/snare/voltron/wiki/Installation

lldb info:

$ lldb -vV
lldb-360.99.0

$ lldb -P
/usr/local/Cellar/llvm/4.0.0_1/lib/python2.7/site-packages

voltron:

$ lldb 
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> import voltron
>>> print voltron
<module 'voltron' from './lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/__init__.pyc'>

I'm sure I've installed things correctly, however I'm using updated version of
lldb from homebrew.

So, would lldb v4.x.x be the issue?

The reason I asked because from the debug log I gathered (shown below), there isn't any conflicts with
lldb and python.

(Pdb) step
> ./lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/plugins/debugger/dbg_lldb.py(394)command()
-> res = lldb.SBCommandReturnObject()
(Pdb) pp lldb
<module 'lldb' from '/usr/local/Cellar/llvm/4.0.0_1/lib/python2.7/site-packages/lldb/__init__.pyc'>
(Pdb) n
> ./lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/plugins/debugger/dbg_lldb.py(395)command()
-> ci = self.host.GetCommandInterpreter()
(Pdb) pp res
<lldb.SBCommandReturnObject; proxy of <Swig Object of type 'lldb::SBCommandReturnObject *' at 0x11368ec60> >
(Pdb) pp self
<dbg_lldb.LLDBAdaptor object at 0x113a35410>
(Pdb) pp command
'script import voltron'
(Pdb) pp voltron
<module 'voltron' from './lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/__init__.pyc'>
(Pdb) list
392                 # for some reason this doesn't work - figure it out
393                 if command:
394                     res = lldb.SBCommandReturnObject()
395                     ci = self.host.GetCommandInterpreter()
396                     ci.HandleCommand(str(command), res, False)
397  ->                 if res.Succeeded():
398                         return res.GetOutput().strip()
399                     else:
400                         raise Exception(res.GetError().strip())
401                 else:
402                     raise Exception("No command specified")
(Pdb) n
> ./lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/plugins/debugger/dbg_lldb.py(398)command()
-> return res.GetOutput().strip()
(Pdb) list
393                 if command:
394                     res = lldb.SBCommandReturnObject()
395                     ci = self.host.GetCommandInterpreter()
396                     ci.HandleCommand(str(command), res, False)
397                     if res.Succeeded():
398  ->                     return res.GetOutput().strip()
399                     else:
400                         raise Exception(res.GetError().strip())
401                 else:
402                     raise Exception("No command specified")
403
(Pdb) n
AttributeError: "'NoneType' object has no attribute 'strip'"
> ./lib/python2.7/site-packages/voltron-0.1.7-py2.7.egg/voltron/plugins/debugger/dbg_lldb.py(398)command()
-> return res.GetOutput().strip()

Any good idea to resolve this? I wouldn't mind digging into the issue.

@snare
Copy link
Owner

snare commented May 4, 2017 via email

@nateozem
Copy link
Contributor Author

nateozem commented May 4, 2017

Here are the output for command and res:

(Pdb) pp command
'script import voltron'
(Pdb) pp res
<lldb.SBCommandReturnObject; proxy of <Swig Object of type 'lldb::SBCommandReturnObject *' at 0x11368ec60> >

Thanks. I'll try to see what I can do.

@snare
Copy link
Owner

snare commented May 4, 2017 via email

@nateozem
Copy link
Contributor Author

nateozem commented May 4, 2017

Cool thanks. I'll give it a try.

@nateozem
Copy link
Contributor Author

nateozem commented May 4, 2017

Nice. It works. I'll create PR (even though I just copy and paste your snippet), unless told otherwise.

I wonder why it works?

@snare
Copy link
Owner

snare commented May 4, 2017 via email

@nateozem
Copy link
Contributor Author

nateozem commented May 4, 2017

sure

@nateozem nateozem closed this as completed May 4, 2017
@phcerdan
Copy link

Facing this, is it merged?

@nateozem
Copy link
Contributor Author

yes, it's. I problem went away.

Do you have the same version or have you pulled the latest commit from master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants