forked from OSchip/llvm-project
Cleaned up the documentation strings for many helper objects and added
lldb.SBModule.section and lldb.SBModule.sections property access. llvm-svn: 149665
This commit is contained in:
parent
96c755d13c
commit
b62bb8cedc
|
@ -248,7 +248,7 @@ public:
|
|||
|
||||
%pythoncode %{
|
||||
class symbols_access(object):
|
||||
re_type = type(re.compile('.'))
|
||||
re_compile_type = type(re.compile('.'))
|
||||
'''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
|
||||
def __init__(self, sbmodule):
|
||||
self.sbmodule = sbmodule
|
||||
|
@ -259,7 +259,7 @@ public:
|
|||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = self.sbmodule.GetNumSymbols()
|
||||
count = len(self)
|
||||
if type(key) is int:
|
||||
if key < count:
|
||||
return self.sbmodule.GetSymbolAtIndex(key)
|
||||
|
@ -269,9 +269,8 @@ public:
|
|||
symbol = self.sbmodule.GetSymbolAtIndex(idx)
|
||||
if symbol.name == key or symbol.mangled == key:
|
||||
matches.append(symbol)
|
||||
if len(matches):
|
||||
return matches
|
||||
elif isinstance(key, self.re_type):
|
||||
return matches
|
||||
elif isinstance(key, self.re_compile_type):
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
symbol = self.sbmodule.GetSymbolAtIndex(idx)
|
||||
|
@ -288,29 +287,83 @@ public:
|
|||
re_match = key.search(mangled)
|
||||
if re_match:
|
||||
matches.append(symbol)
|
||||
if len(matches):
|
||||
return matches
|
||||
return matches
|
||||
else:
|
||||
print "error: unsupported item type: %s" % type(key)
|
||||
return None
|
||||
|
||||
def get_symbols_access_object(self):
|
||||
'''An accessor function that retuns a symbols_access() object which allows lazy module array access.'''
|
||||
'''An accessor function that returns a symbols_access() object which allows lazy symbol access from a lldb.SBModule object.'''
|
||||
return self.symbols_access (self)
|
||||
|
||||
def get_symbols_array(self):
|
||||
'''An accessor function that retuns an array object that contains all modules in this target object.'''
|
||||
'''An accessor function that returns a list() that contains all symbols in a lldb.SBModule object.'''
|
||||
symbols = []
|
||||
for idx in range(self.GetNumSymbols()):
|
||||
for idx in range(self.num_symbols):
|
||||
symbols.append(self.GetSymbolAtIndex(idx))
|
||||
return symbols
|
||||
|
||||
class sections_access(object):
|
||||
re_compile_type = type(re.compile('.'))
|
||||
'''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
|
||||
def __init__(self, sbmodule):
|
||||
self.sbmodule = sbmodule
|
||||
|
||||
def __len__(self):
|
||||
if self.sbmodule:
|
||||
return self.sbmodule.GetNumSections()
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = len(self)
|
||||
if type(key) is int:
|
||||
if key < count:
|
||||
return self.sbmodule.GetSectionAtIndex(key)
|
||||
elif type(key) is str:
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
section = self.sbmodule.GetSectionAtIndex(idx)
|
||||
if section.name == key:
|
||||
matches.append(section)
|
||||
return matches
|
||||
elif isinstance(key, self.re_compile_type):
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
section = self.sbmodule.GetSectionAtIndex(idx)
|
||||
name = section.name
|
||||
if name:
|
||||
re_match = key.search(name)
|
||||
if re_match:
|
||||
matches.append(section)
|
||||
return matches
|
||||
else:
|
||||
print "error: unsupported item type: %s" % type(key)
|
||||
return None
|
||||
|
||||
def get_sections_access_object(self):
|
||||
'''An accessor function that returns a sections_access() object which allows lazy section array access.'''
|
||||
return self.sections_access (self)
|
||||
|
||||
def get_sections_array(self):
|
||||
'''An accessor function that returns an array object that contains all sections in this module object.'''
|
||||
if not hasattr(self, 'sections'):
|
||||
self.sections = []
|
||||
for idx in range(self.num_sections):
|
||||
self.sections.append(self.GetSectionAtIndex(idx))
|
||||
return self.sections
|
||||
|
||||
__swig_getmethods__["symbols"] = get_symbols_array
|
||||
if _newclass: x = property(get_symbols_array, None)
|
||||
|
||||
__swig_getmethods__["symbol"] = get_symbols_access_object
|
||||
if _newclass: x = property(get_symbols_access_object, None)
|
||||
|
||||
__swig_getmethods__["sections"] = get_sections_array
|
||||
if _newclass: x = property(get_sections_array, None)
|
||||
|
||||
__swig_getmethods__["section"] = get_sections_access_object
|
||||
if _newclass: x = property(get_sections_access_object, None)
|
||||
|
||||
def get_uuid(self):
|
||||
return uuid.UUID (self.GetUUIDString())
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ public:
|
|||
return True
|
||||
return False
|
||||
|
||||
class thread_array_access(object):
|
||||
class threads_access(object):
|
||||
'''A helper object that will lazily hand out thread for a process when supplied an index.'''
|
||||
def __init__(self, sbprocess):
|
||||
self.sbprocess = sbprocess
|
||||
|
@ -323,12 +323,12 @@ public:
|
|||
return self.sbprocess.GetThreadAtIndex(key)
|
||||
return None
|
||||
|
||||
def get_thread_array_access_object(self):
|
||||
'''An accessor function that retuns a thread_array_access() object which allows lazy thread array access.'''
|
||||
return self.thread_array_access (self)
|
||||
def get_threads_access_object(self):
|
||||
'''An accessor function that returns a modules_access() object which allows lazy thread access from a lldb.SBProcess object.'''
|
||||
return self.threads_access (self)
|
||||
|
||||
def get_process_thread_list(self):
|
||||
'''An accessor function that retuns an array object that contains all threads in this process object.'''
|
||||
'''An accessor function that returns a list() that contains all threads in a lldb.SBProcess object.'''
|
||||
threads = []
|
||||
for idx in range(self.GetNumThreads()):
|
||||
threads.append(GetThreadAtIndex(idx))
|
||||
|
@ -337,8 +337,8 @@ public:
|
|||
__swig_getmethods__["threads"] = get_process_thread_list
|
||||
if _newclass: x = property(get_process_thread_list, None)
|
||||
|
||||
__swig_getmethods__["thread"] = get_thread_array_access_object
|
||||
if _newclass: x = property(get_thread_array_access_object, None)
|
||||
__swig_getmethods__["thread"] = get_threads_access_object
|
||||
if _newclass: x = property(get_threads_access_object, None)
|
||||
|
||||
__swig_getmethods__["is_alive"] = __get_is_alive__
|
||||
if _newclass: x = property(__get_is_alive__, None)
|
||||
|
|
|
@ -538,11 +538,11 @@ public:
|
|||
return None
|
||||
|
||||
def get_modules_access_object(self):
|
||||
'''An accessor function that retuns a modules_access() object which allows lazy module array access.'''
|
||||
'''An accessor function that returns a modules_access() object which allows lazy module access from a lldb.SBTarget object.'''
|
||||
return self.modules_access (self)
|
||||
|
||||
def get_modules_array(self):
|
||||
'''An accessor function that retuns an array object that contains all modules in this target object.'''
|
||||
'''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
|
||||
modules = []
|
||||
for idx in range(self.GetNumModules()):
|
||||
modules.append(self.GetModuleAtIndex(idx))
|
||||
|
|
|
@ -175,7 +175,7 @@ public:
|
|||
GetDescription (lldb::SBStream &description) const;
|
||||
|
||||
%pythoncode %{
|
||||
class frame_array_access(object):
|
||||
class frames_access(object):
|
||||
'''A helper object that will lazily hand out frames for a thread when supplied an index.'''
|
||||
def __init__(self, sbthread):
|
||||
self.sbthread = sbthread
|
||||
|
@ -190,12 +190,12 @@ public:
|
|||
return self.sbthread.GetFrameAtIndex(key)
|
||||
return None
|
||||
|
||||
def get_frame_array_access_object(self):
|
||||
'''An accessor function that retuns a frame_array_access() object which allows lazy frame array access.'''
|
||||
return self.frame_array_access (self)
|
||||
def get_frames_access_object(self):
|
||||
'''An accessor function that returns a frames_access() object which allows lazy frame access from a lldb.SBThread object.'''
|
||||
return self.frames_access (self)
|
||||
|
||||
def get_thread_frames(self):
|
||||
'''An accessor function that retuns an array object that contains all frames in this thread object.'''
|
||||
'''An accessor function that returns a list() that contains all frames in a lldb.SBThread object.'''
|
||||
frames = []
|
||||
for frame in self:
|
||||
frames.append(frame)
|
||||
|
@ -219,8 +219,8 @@ public:
|
|||
__swig_getmethods__["frames"] = get_thread_frames
|
||||
if _newclass: x = property(get_thread_frames, None)
|
||||
|
||||
__swig_getmethods__["frame"] = get_frame_array_access_object
|
||||
if _newclass: x = property(get_frame_array_access_object, None)
|
||||
__swig_getmethods__["frame"] = get_frames_access_object
|
||||
if _newclass: x = property(get_frames_access_object, None)
|
||||
|
||||
__swig_getmethods__["name"] = GetName
|
||||
if _newclass: x = property(GetName, None)
|
||||
|
|
Loading…
Reference in New Issue