[lldb][LocateModuleCallback] Update SBFileSpec/SBModuleSpec

RFC https://discourse.llvm.org/t/rfc-python-callback-for-target-get-module/71580

SBFileSpec and SBModuleSpec will be used for locate module callback as Python
function arguments. This diff allows these things.
- Can be instantiated from SBPlatform.
- Can be passed to/from Python.
- Can be accessed for object offset and size.

Differential Revision: https://reviews.llvm.org/D153733
This commit is contained in:
Kazuki Sakamoto
2023-06-18 22:05:54 -07:00
committed by Kazuki Sakamoto
parent e9877eca40
commit c4fa6fafc4
5 changed files with 80 additions and 0 deletions

View File

@@ -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)