splhack updated this revision to Diff 538660.
splhack added a comment.
Fix LLDB_INSTRUMENT_VA args
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153733/new/
https://reviews.llvm.org/D153733
Files:
lldb/bindings/python/python-swigsafecast.swig
lldb/include/lldb/API/SBFileSpec.h
lldb/include/lldb/API/SBModuleSpec.h
lldb/source/API/SBModuleSpec.cpp
lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
lldb/test/API/python_api/module_spec/TestModuleSpec.py
Index: lldb/test/API/python_api/module_spec/TestModuleSpec.py
===================================================================
--- /dev/null
+++ lldb/test/API/python_api/module_spec/TestModuleSpec.py
@@ -0,0 +1,24 @@
+"""
+Test some SBModuleSpec APIs.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class ModuleSpecAPIsTestCase(TestBase):
+ def test_object_offset_and_size(self):
+ module_spec = lldb.SBModuleSpec()
+ self.assertEqual(module_spec.GetObjectOffset(), 0)
+ self.assertEqual(module_spec.GetObjectSize(), 0)
+
+ module_spec.SetObjectOffset(4096)
+ self.assertEqual(module_spec.GetObjectOffset(), 4096)
+
+ module_spec.SetObjectSize(3600)
+ self.assertEqual(module_spec.GetObjectSize(), 3600)
+
+ module_spec.Clear()
+ self.assertEqual(module_spec.GetObjectOffset(), 0)
+ self.assertEqual(module_spec.GetObjectSize(), 0)
Index: lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
@@ -30,6 +30,8 @@
class SBValue;
class SBStream;
class SBStructuredData;
+class SBFileSpec;
+class SBModuleSpec;
} // namespace lldb
namespace lldb_private {
@@ -102,6 +104,10 @@
static PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStream> stream_sb);
static PythonObject
ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData> data_sb);
+ static PythonObject
+ ToSWIGWrapper(std::unique_ptr<lldb::SBFileSpec> file_spec_sb);
+ static PythonObject
+ ToSWIGWrapper(std::unique_ptr<lldb::SBModuleSpec> module_spec_sb);
static python::ScopedPythonObject<lldb::SBCommandReturnObject>
ToSWIGWrapper(CommandReturnObject &cmd_retobj);
Index: lldb/source/API/SBModuleSpec.cpp
===================================================================
--- lldb/source/API/SBModuleSpec.cpp
+++ lldb/source/API/SBModuleSpec.cpp
@@ -29,6 +29,11 @@
m_opaque_up = clone(rhs.m_opaque_up);
}
+SBModuleSpec::SBModuleSpec(const lldb_private::ModuleSpec &module_spec)
+ : m_opaque_up(new lldb_private::ModuleSpec(module_spec)) {
+ LLDB_INSTRUMENT_VA(this);
+}
+
const SBModuleSpec &SBModuleSpec::operator=(const SBModuleSpec &rhs) {
LLDB_INSTRUMENT_VA(this, rhs);
@@ -145,6 +150,30 @@
return true;
}
+uint64_t SBModuleSpec::GetObjectOffset() {
+ LLDB_INSTRUMENT_VA(this);
+
+ return m_opaque_up->GetObjectOffset();
+}
+
+void SBModuleSpec::SetObjectOffset(uint64_t object_offset) {
+ LLDB_INSTRUMENT_VA(this, object_offset);
+
+ m_opaque_up->SetObjectOffset(object_offset);
+}
+
+uint64_t SBModuleSpec::GetObjectSize() {
+ LLDB_INSTRUMENT_VA(this);
+
+ return m_opaque_up->GetObjectSize();
+}
+
+void SBModuleSpec::SetObjectSize(uint64_t object_size) {
+ LLDB_INSTRUMENT_VA(this, object_size);
+
+ m_opaque_up->SetObjectSize(object_size);
+}
+
SBModuleSpecList::SBModuleSpecList() : m_opaque_up(new ModuleSpecList()) {
LLDB_INSTRUMENT_VA(this);
}
Index: lldb/include/lldb/API/SBModuleSpec.h
===================================================================
--- lldb/include/lldb/API/SBModuleSpec.h
+++ lldb/include/lldb/API/SBModuleSpec.h
@@ -12,6 +12,12 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
+namespace lldb_private {
+namespace python {
+class SWIGBridge;
+} // namespace python
+} // namespace lldb_private
+
namespace lldb {
class LLDB_API SBModuleSpec {
@@ -77,6 +83,14 @@
bool SetUUIDBytes(const uint8_t *uuid, size_t uuid_len);
+ uint64_t GetObjectOffset();
+
+ void SetObjectOffset(uint64_t object_offset);
+
+ uint64_t GetObjectSize();
+
+ void SetObjectSize(uint64_t object_size);
+
bool GetDescription(lldb::SBStream &description);
private:
@@ -84,6 +98,10 @@
friend class SBModule;
friend class SBTarget;
+ friend class lldb_private::python::SWIGBridge;
+
+ SBModuleSpec(const lldb_private::ModuleSpec &module_spec);
+
std::unique_ptr<lldb_private::ModuleSpec> m_opaque_up;
};
Index: lldb/include/lldb/API/SBFileSpec.h
===================================================================
--- lldb/include/lldb/API/SBFileSpec.h
+++ lldb/include/lldb/API/SBFileSpec.h
@@ -11,6 +11,12 @@
#include "lldb/API/SBDefines.h"
+namespace lldb_private {
+namespace python {
+class SWIGBridge;
+} // namespace python
+} // namespace lldb_private
+
namespace lldb {
class LLDB_API SBFileSpec {
@@ -79,6 +85,8 @@
friend class SBThread;
friend class SBTrace;
+ friend class lldb_private::python::SWIGBridge;
+
SBFileSpec(const lldb_private::FileSpec &fspec);
void SetFileSpec(const lldb_private::FileSpec &fspec);
Index: lldb/bindings/python/python-swigsafecast.swig
===================================================================
--- lldb/bindings/python/python-swigsafecast.swig
+++ lldb/bindings/python/python-swigsafecast.swig
@@ -120,5 +120,15 @@
SWIGTYPE_p_lldb__SBEvent);
}
+PythonObject SWIGBridge::ToSWIGWrapper(
+ std::unique_ptr<lldb::SBFileSpec> file_spec_sb) {
+ return ToSWIGHelper(file_spec_sb.release(), SWIGTYPE_p_lldb__SBFileSpec);
+}
+
+PythonObject SWIGBridge::ToSWIGWrapper(
+ std::unique_ptr<lldb::SBModuleSpec> module_spec_sb) {
+ return ToSWIGHelper(module_spec_sb.release(), SWIGTYPE_p_lldb__SBModuleSpec);
+}
+
} // namespace python
} // namespace lldb_private
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits