diff options
| -rw-r--r-- | lldb/include/lldb/API/SBAddress.h | 5 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBAddress.i | 8 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBModule.i | 4 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBSection.i | 6 | ||||
| -rw-r--r-- | lldb/source/API/SBAddress.cpp | 15 |
5 files changed, 35 insertions, 3 deletions
diff --git a/lldb/include/lldb/API/SBAddress.h b/lldb/include/lldb/API/SBAddress.h index 77560f4c0f7..b512ed66b52 100644 --- a/lldb/include/lldb/API/SBAddress.h +++ b/lldb/include/lldb/API/SBAddress.h @@ -23,6 +23,8 @@ public: SBAddress (const lldb::SBAddress &rhs); + SBAddress (lldb::SBSection section, lldb::addr_t offset); + // Create an address by resolving a load address using the supplied target SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target); @@ -46,6 +48,9 @@ public: GetLoadAddress (const lldb::SBTarget &target) const; void + SetAddress (lldb::SBSection section, lldb::addr_t offset); + + void SetLoadAddress (lldb::addr_t load_addr, lldb::SBTarget &target); bool diff --git a/lldb/scripts/Python/interface/SBAddress.i b/lldb/scripts/Python/interface/SBAddress.i index 1472c4f3588..7d3e36c66fd 100644 --- a/lldb/scripts/Python/interface/SBAddress.i +++ b/lldb/scripts/Python/interface/SBAddress.i @@ -50,6 +50,9 @@ public: 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 @@ public: 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/lldb/scripts/Python/interface/SBModule.i b/lldb/scripts/Python/interface/SBModule.i index d66e169f0d9..49e032d8b82 100644 --- a/lldb/scripts/Python/interface/SBModule.i +++ b/lldb/scripts/Python/interface/SBModule.i @@ -320,12 +320,10 @@ public: 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/lldb/scripts/Python/interface/SBSection.i b/lldb/scripts/Python/interface/SBSection.i index 78980b51667..95838755c59 100644 --- a/lldb/scripts/Python/interface/SBSection.i +++ b/lldb/scripts/Python/interface/SBSection.i @@ -88,9 +88,15 @@ public: 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) diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp index 430e11aa1d4..7397588eaf4 100644 --- a/lldb/source/API/SBAddress.cpp +++ b/lldb/source/API/SBAddress.cpp @@ -103,6 +103,12 @@ SBAddress::SBAddress (const SBAddress &rhs) : m_opaque_ap.reset (new AddressImpl(*rhs.m_opaque_ap.get())); } + +SBAddress::SBAddress (lldb::SBSection section, lldb::addr_t offset) : + m_opaque_ap(new AddressImpl (Address(section.GetSection(), offset))) +{ +} + // Create an address by resolving a load address using the supplied target SBAddress::SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target) : m_opaque_ap() @@ -142,6 +148,15 @@ SBAddress::Clear () } void +SBAddress::SetAddress (lldb::SBSection section, lldb::addr_t offset) +{ + Address &addr = ref(); + addr.SetSection (section.GetSection()); + addr.SetOffset (offset); +} + + +void SBAddress::SetAddress (const Address *lldb_object_ptr) { if (lldb_object_ptr) |

