[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 04:12:25 PST 2023
Michael137 created this revision.
Michael137 added a reviewer: labath.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This patch adds a test for formatting of member function pointers.
This was split from https://reviews.llvm.org/D145242, which caused
this test case to fail on Windows buildbots.
I split this out in order to make sure that this indeed works on Windows
without the D145242 <https://reviews.llvm.org/D145242> patch.
Repository:
rG LLVM Github Monorepo
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-9]{2}\s)+01'])
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145487.502983.patch
Type: text/x-patch
Size: 2187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230307/fdd14a2c/attachment-0001.bin>
More information about the lldb-commits
mailing list