[libcxx-commits] [PATCH] D109204: [libc++][NFC] Mark values in gdb pretty print comparison functions as live to prevent values being optimized out.

Amy Kwan via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 2 16:03:45 PDT 2021


amyk created this revision.
amyk added a reviewer: saugustine.
amyk added a project: libc++.
amyk requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

It appears when testing LLVM 13 on Power, we run into failures with the `libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp`
test case optimizing values out.

Despite some the functions in the test already being marked with optnone, adding the `MarkAsLive()` 
calls inside of the pretty printer comparison functions resolves the issues of the values being optimized out.

This patch aims to address https://bugs.llvm.org/show_bug.cgi?id=51675.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109204

Files:
  libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp


Index: libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
===================================================================
--- libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
+++ libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
@@ -92,24 +92,28 @@
 template <typename TypeToPrint> void ComparePrettyPrintToChars(
     TypeToPrint value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 
 template <typename TypeToPrint> void ComparePrettyPrintToRegex(
     TypeToPrint value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 
 void CompareExpressionPrettyPrintToChars(
     std::string value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 
 void CompareExpressionPrettyPrintToRegex(
     std::string value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109204.370417.patch
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210902/dba81f4e/attachment-0001.bin>


More information about the libcxx-commits mailing list