[Lldb-commits] [lldb] 554f79e - [lldb][test] TestDataFormatterCpp.py: add test-case for member function pointer format
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 7 06:17:53 PST 2023
Author: Michael Buch
Date: 2023-03-07T14:17:35Z
New Revision: 554f79e050cb240d00e239ee4ca8d6aefdfa737d
URL: https://github.com/llvm/llvm-project/commit/554f79e050cb240d00e239ee4ca8d6aefdfa737d
DIFF: https://github.com/llvm/llvm-project/commit/554f79e050cb240d00e239ee4ca8d6aefdfa737d.diff
LOG: [lldb][test] TestDataFormatterCpp.py: add test-case for member function pointer format
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 patch.
Differential Revision: https://reviews.llvm.org/D145487
Added:
Modified:
lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp
Removed:
################################################################################
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
index fa9a3f5093d05..226cb8fd9ed06 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
@@ -285,3 +285,17 @@ def cleanup():
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'])
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp
index c81a68fd2094a..1b54acf811e87 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp
@@ -57,6 +57,9 @@ struct IUseCharStar
{
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 @@ int main (int argc, const char * argv[])
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.
}
More information about the lldb-commits
mailing list