summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/interface
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-02-03 03:22:53 +0000
committerGreg Clayton <gclayton@apple.com>2012-02-03 03:22:53 +0000
commitb62bb8cedc9452886b8e64e8a39f3d0e34d6975e (patch)
treed945f5b87c4ff5ce99d9a611b4ede5721cd08407 /lldb/scripts/Python/interface
parent96c755d13c58487ecd1a8d0cbbd017364c1725a0 (diff)
downloadbcm5719-llvm-b62bb8cedc9452886b8e64e8a39f3d0e34d6975e.tar.gz
bcm5719-llvm-b62bb8cedc9452886b8e64e8a39f3d0e34d6975e.zip
Cleaned up the documentation strings for many helper objects and added
lldb.SBModule.section and lldb.SBModule.sections property access. llvm-svn: 149665
Diffstat (limited to 'lldb/scripts/Python/interface')
-rw-r--r--lldb/scripts/Python/interface/SBModule.i73
-rw-r--r--lldb/scripts/Python/interface/SBProcess.i14
-rw-r--r--lldb/scripts/Python/interface/SBTarget.i4
-rw-r--r--lldb/scripts/Python/interface/SBThread.i14
4 files changed, 79 insertions, 26 deletions
diff --git a/lldb/scripts/Python/interface/SBModule.i b/lldb/scripts/Python/interface/SBModule.i
index d3c43523604..d66e169f0d9 100644
--- a/lldb/scripts/Python/interface/SBModule.i
+++ b/lldb/scripts/Python/interface/SBModule.i
@@ -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())
diff --git a/lldb/scripts/Python/interface/SBProcess.i b/lldb/scripts/Python/interface/SBProcess.i
index 77b65b74394..df58f169aa9 100644
--- a/lldb/scripts/Python/interface/SBProcess.i
+++ b/lldb/scripts/Python/interface/SBProcess.i
@@ -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)
diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i
index 0307ec14af6..d917530ad0d 100644
--- a/lldb/scripts/Python/interface/SBTarget.i
+++ b/lldb/scripts/Python/interface/SBTarget.i
@@ -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))
diff --git a/lldb/scripts/Python/interface/SBThread.i b/lldb/scripts/Python/interface/SBThread.i
index 4d3cb719126..93fd7f98e1e 100644
--- a/lldb/scripts/Python/interface/SBThread.i
+++ b/lldb/scripts/Python/interface/SBThread.i
@@ -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)
OpenPOWER on IntegriCloud