[Lldb-commits] [lldb] r224151 - Add a test case to validate that AddressOf() and GetLoadAddress() work on a ValueObjectConstResult. This test passing is the baseline of functionality we want to ensure for our const results

Enrico Granata egranata at apple.com
Fri Dec 12 13:23:55 PST 2014


Author: enrico
Date: Fri Dec 12 15:23:55 2014
New Revision: 224151

URL: http://llvm.org/viewvc/llvm-project?rev=224151&view=rev
Log:
Add a test case to validate that AddressOf() and GetLoadAddress() work on a ValueObjectConstResult. This test passing is the baseline of functionality we want to ensure for our const results

Added:
    lldb/trunk/test/python_api/sbvalue_const_addrof/
    lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py
    lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp

Added: lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py?rev=224151&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py (added)
+++ lldb/trunk/test/python_api/sbvalue_const_addrof/TestSBValueConstAddrOf.py Fri Dec 12 15:23:55 2014
@@ -0,0 +1,3 @@
+import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())

Added: lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp?rev=224151&view=auto
==============================================================================
--- lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp (added)
+++ lldb/trunk/test/python_api/sbvalue_const_addrof/main.cpp Fri Dec 12 15:23:55 2014
@@ -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")
+}





More information about the lldb-commits mailing list