snare / voltron

A hacky debugger UI for hackers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

nateozem opened this issue · comments

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.

commented

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.

commented

Cool thanks. I'll give it a try.

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

I wonder why it works?

commented

sure

Facing this, is it merged?

yes, it's. I problem went away.

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