[Lldb-commits] [PATCH] D145487: [lldb][test] TestDataFormatterCpp.py: add test-case for member function pointer format

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 7 06:17:18 PST 2023


Michael137 updated this revision to Diff 503021.
Michael137 added a comment.

- Add back simplified virtual function ptr assertion


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145487/new/

https://reviews.llvm.org/D145487

Files:
  lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
  lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp


Index: lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp
===================================================================
--- lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp
+++ lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp
@@ -57,6 +57,9 @@
 {
 	const char* pointer;
 	IUseCharStar() : pointer("Hello world") {}
+
+        char const *member_func(int) { return ""; }
+        virtual void virt_member_func() {}
 };
 
 int main (int argc, const char * argv[])
@@ -106,7 +109,15 @@
     char* strptr     = "Hello world!";
     
     i_am_cooler the_coolest_guy(1,2,3.14,6.28,'E','G');
-        
+
+    const char *IUseCharStar::*member_ptr = &IUseCharStar::pointer;
+    const char *(IUseCharStar::*member_func_ptr)(int) =
+        &IUseCharStar::member_func;
+    auto &ref_to_member_func_ptr = member_func_ptr;
+
+    void (IUseCharStar::*virt_member_func_ptr)() =
+        &IUseCharStar::virt_member_func;
+
     return 0; // Set break point at this line.
 }
 
Index: lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
===================================================================
--- lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
@@ -285,3 +285,17 @@
             matching=False,
             substrs=['(int) iAmInt = 0x00000001'])
         self.expect("frame variable iAmInt", substrs=['(int) iAmInt = 1'])
+
+        # FIXME: don't format pointer to members as bytes, but rather as regular pointers
+        self.expect(
+            "frame variable member_ptr",
+            patterns=['member_ptr = [0-9a-z]{2}\s'])
+        self.expect(
+            "frame variable member_func_ptr",
+            patterns=['member_func_ptr = [0-9a-z]{2}\s'])
+        self.expect(
+            "frame variable ref_to_member_func_ptr",
+            patterns=['ref_to_member_func_ptr = [0-9a-z]{2}\s'])
+        self.expect(
+            "frame variable virt_member_func_ptr",
+            patterns=['virt_member_func_ptr = [0-9a-z]{2}\s'])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145487.503021.patch
Type: text/x-patch
Size: 2185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230307/36344678/attachment-0001.bin>


More information about the lldb-commits mailing list