From d4dd7993b55811b9d3f1fa2d13c8c26dcfcfa2b2 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Tue, 27 Sep 2011 01:19:20 +0000 Subject: Export the watchpoint related API (SBWatchpointLocation class and added SBTarget methods) to the Python interface. Implement yet another (threre're 3 now) iterator protocol for SBTarget: watchpoint_location_iter(), to iterate on the available watchpoint locations. And add a print representation for SBWatchpointLocation. Exercise some of these Python API with TestWatchpointLocationIter.py. llvm-svn: 140595 --- lldb/scripts/Python/modify-python-lldb.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lldb/scripts/Python/modify-python-lldb.py') diff --git a/lldb/scripts/Python/modify-python-lldb.py b/lldb/scripts/Python/modify-python-lldb.py index 33929c6..4624677 100644 --- a/lldb/scripts/Python/modify-python-lldb.py +++ b/lldb/scripts/Python/modify-python-lldb.py @@ -150,6 +150,7 @@ linked_list_iter_def = ''' iter_def = " def __iter__(self): return lldb_iter(self, '%s', '%s')" module_iter = " def module_iter(self): return lldb_iter(self, '%s', '%s')" breakpoint_iter = " def breakpoint_iter(self): return lldb_iter(self, '%s', '%s')" +watchpoint_location_iter = " def watchpoint_location_iter(self): return lldb_iter(self, '%s', '%s')" section_iter = " def section_iter(self): return lldb_iter(self, '%s', '%s')" # Called to implement the built-in function len(). @@ -187,7 +188,8 @@ d = { 'SBBreakpoint': ('GetNumLocations', 'GetLocationAtIndex'), # SBTarget needs special processing, see below. 'SBTarget': {'module': ('GetNumModules', 'GetModuleAtIndex'), - 'breakpoint': ('GetNumBreakpoints', 'GetBreakpointAtIndex') + 'breakpoint': ('GetNumBreakpoints', 'GetBreakpointAtIndex'), + 'watchpoint_location': ('GetNumWatchpointLocations', 'GetWatchpointLocationAtIndex') }, # SBModule has an additional section_iter(), see below. @@ -325,10 +327,11 @@ for line in content.splitlines(): # We found the beginning of the __init__ method definition. # This is a good spot to insert the iter and/or eq-ne support. # - # But note that SBTarget has two types of iterations. + # But note that SBTarget has three types of iterations. if cls == "SBTarget": new_content.add_line(module_iter % (d[cls]['module'])) new_content.add_line(breakpoint_iter % (d[cls]['breakpoint'])) + new_content.add_line(watchpoint_location_iter % (d[cls]['watchpoint_location'])) else: if (state & DEFINING_ITERATOR): new_content.add_line(iter_def % d[cls]) -- cgit v1.1