summaryrefslogtreecommitdiffstats
path: root/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-06 20:12:03 +0000
committerdim <dim@FreeBSD.org>2016-01-06 20:12:03 +0000
commit78b9749c0a4ea980a8b934645da6ae98fcc665e8 (patch)
treedd2a1ddf0476664c2b823409c36cbccd52662ca7 /packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof
parent60cb593f9d55fa5ca7a5372b731f2330345b4b9a (diff)
downloadFreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.zip
FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.tar.gz
Vendor import of lldb trunk r256945:
https://llvm.org/svn/llvm-project/lldb/trunk@256945
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof')
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/Makefile4
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py3
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/main.cpp40
3 files changed, 47 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/Makefile b/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/Makefile
new file mode 100644
index 0000000..a9c1edd
--- /dev/null
+++ b/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/Makefile
@@ -0,0 +1,4 @@
+LEVEL = ../../make
+CXX_SOURCES := main.cpp
+CXXFLAGS += -std=c++11
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py b/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py
new file mode 100644
index 0000000..a3d43c1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py
@@ -0,0 +1,3 @@
+import lldbsuite.test.lldbinline as lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
diff --git a/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/main.cpp b/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/main.cpp
new file mode 100644
index 0000000..eb9c8e0
--- /dev/null
+++ b/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/main.cpp
@@ -0,0 +1,40 @@
+#include <stdio.h>
+#include <stdint.h>
+
+struct RegisterContext
+{
+ uintptr_t r0;
+ uintptr_t r1;
+ uintptr_t r2;
+ uintptr_t r3;
+ uintptr_t r4;
+ uintptr_t pc;
+ uintptr_t fp;
+ uintptr_t sp;
+};
+
+struct ThreadInfo {
+ uint32_t tid;
+ const char *name;
+ RegisterContext regs;
+ ThreadInfo *next;
+};
+int main (int argc, char const *argv[], char const *envp[]);
+
+ThreadInfo g_thread2 = { 0x2222, "thread2", { 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, (uintptr_t)&main, 0x2006, 0x2007 }, NULL };
+ThreadInfo g_thread1 = { 0x1111, "thread1", { 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, (uintptr_t)&main, 0x1006, 0x1007 }, &g_thread2 };
+ThreadInfo *g_thread_list_ptr = &g_thread1;
+
+int main (int argc, char const *argv[], char const *envp[])
+{
+ printf ("g_thread_list is %p\n", g_thread_list_ptr);
+ return 0; //% v = lldb.target.FindFirstGlobalVariable('g_thread_list_ptr')
+ //% v_gla = v.GetChildMemberWithName('regs').GetLoadAddress()
+ //% v_aof = v.GetChildMemberWithName('regs').AddressOf().GetValueAsUnsigned(lldb.LLDB_INVALID_ADDRESS)
+ //% expr = '(%s)0x%x' % (v.GetType().GetName(), v.GetValueAsUnsigned(0))
+ //% e = v.CreateValueFromExpression('e', expr)
+ //% e_gla = e.GetChildMemberWithName('regs').GetLoadAddress()
+ //% e_aof = e.GetChildMemberWithName('regs').AddressOf().GetValueAsUnsigned(lldb.LLDB_INVALID_ADDRESS)
+ //% self.assertTrue(v_gla == e_gla, "GetLoadAddress() differs")
+ //% self.assertTrue(v_aof == e_aof, "AddressOf() differs")
+}
OpenPOWER on IntegriCloud