[Lldb-commits] [lldb] r159289 - /lldb/trunk/scripts/Python/interface/SBBlock.i

Greg Clayton gclayton at apple.com
Wed Jun 27 13:23:09 PDT 2012


Author: gclayton
Date: Wed Jun 27 15:23:09 2012
New Revision: 159289

URL: http://llvm.org/viewvc/llvm-project?rev=159289&view=rev
Log:
Modify the ranges_access() helper function to be able to lookup the address range in a block given an address. Since blocks can have multiple discontiguous ranges, it helps to be able to get the current address range for the current block in a frame. This can be used in code like:

curr_block_range = lldb.frame.block.range[lldb.frame.addr]


Modified:
    lldb/trunk/scripts/Python/interface/SBBlock.i

Modified: lldb/trunk/scripts/Python/interface/SBBlock.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBBlock.i?rev=159289&r1=159288&r2=159289&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBBlock.i (original)
+++ lldb/trunk/scripts/Python/interface/SBBlock.i Wed Jun 27 15:23:09 2012
@@ -123,6 +123,10 @@
                 count = len(self)
                 if type(key) is int:
                     return self.sbblock.get_range_at_index (key);
+                if isinstance(key, SBAddress):
+                    range_idx = self.sbblock.GetRangeIndexForBlockAddress(key);
+                    if range_idx < len(self):
+                        return [self.sbblock.GetRangeStartAddress(range_idx), self.sbblock.GetRangeEndAddress(range_idx)]
                 else:
                     print "error: unsupported item type: %s" % type(key)
                 return None





More information about the lldb-commits mailing list