Allow a SBAddress to be created from a SBSection and an offset.

Changed the lldb.SBModule.section[<str>] property to return a single section.

Added a lldb.SBSection.addr property which returns an lldb.SBAddress object.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149755 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/scripts/Python/interface/SBAddress.i b/scripts/Python/interface/SBAddress.i
index 1472c4f..7d3e36c 100644
--- a/scripts/Python/interface/SBAddress.i
+++ b/scripts/Python/interface/SBAddress.i
@@ -50,6 +50,9 @@
 
     SBAddress (const lldb::SBAddress &rhs);
 
+    SBAddress (lldb::SBSection section,
+               lldb::addr_t offset);
+    
     %feature("docstring", "
     Create an address by resolving a load address using the supplied target.
     ") SBAddress;
@@ -85,6 +88,11 @@
     lldb::addr_t
     SBAddress::GetOffset ();
 
+    void
+    SetAddress (lldb::SBSection section, 
+                lldb::addr_t offset);
+             
+
     %feature("docstring", "
     //------------------------------------------------------------------
     /// GetSymbolContext() and the following can lookup symbol information for a given address.
diff --git a/scripts/Python/interface/SBModule.i b/scripts/Python/interface/SBModule.i
index d66e169..49e032d 100644
--- a/scripts/Python/interface/SBModule.i
+++ b/scripts/Python/interface/SBModule.i
@@ -320,12 +320,10 @@
                     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
+                            return section
                 elif isinstance(key, self.re_compile_type):
                     matches = []
                     for idx in range(count):
diff --git a/scripts/Python/interface/SBSection.i b/scripts/Python/interface/SBSection.i
index 78980b5..9583875 100644
--- a/scripts/Python/interface/SBSection.i
+++ b/scripts/Python/interface/SBSection.i
@@ -88,9 +88,15 @@
     GetDescription (lldb::SBStream &description);
     
     %pythoncode %{
+        def get_addr(self):
+            return SBAddress(self, 0)
+
         __swig_getmethods__["name"] = GetName
         if _newclass: x = property(GetName, None)
 
+        __swig_getmethods__["addr"] = get_addr
+        if _newclass: x = property(get_addr, None)
+
         __swig_getmethods__["file_addr"] = GetFileAddress
         if _newclass: x = property(GetFileAddress, None)