[libcxx-commits] [PATCH] D100610: Don't fail the shared_ptr test if libc++ has insufficient debug info.

Sterling Augustine via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 15 18:06:13 PDT 2021


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

Don't fail the shared_ptr test if libc++ has insufficient debug info.

This addresses https://bugs.llvm.org/show_bug.cgi?id=48937


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100610

Files:
  libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py


Index: libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
===================================================================
--- libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
+++ libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
@@ -37,6 +37,23 @@
             compare_frame = gdb.newest_frame().older()
             testcase_frame = compare_frame.older()
             test_loc = testcase_frame.find_sal()
+
+            expectation_val = compare_frame.read_var("expectation")
+            check_literal = expectation_val.string(encoding="utf-8")
+
+            # Heuristic to determine if libc++ itself has debug
+            # info. If it doesn't, then anything normally homed there
+            # won't be found, and the printer will error. We don't
+            # want to fail the test in this case--the printer itself
+            # is probably fine, or at least we can't tell.
+            if check_literal.startswith("std::shared_ptr"):
+                shared_ptr = compare_frame.read_var("value")
+                if not "__shared_owners_" in shared_ptr.type.fields():
+                    print("IGNORED (no debug info in libc++): " +
+                          test_loc.symtab.filename + ":" +
+                          str(test_loc.line))
+                    return
+
             # Use interactive commands in the correct context to get the pretty
             # printed version
 
@@ -46,8 +63,6 @@
             value = value_str[value_str.find("= ") + 2:-1]
             gdb.newest_frame().select()
 
-            expectation_val = compare_frame.read_var("expectation")
-            check_literal = expectation_val.string(encoding="utf-8")
             if "PrettyPrintToRegex" in compare_frame.name():
                 test_fails = not re.match(check_literal, value)
             else:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100610.337956.patch
Type: text/x-patch
Size: 1806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210416/b5c25bb7/attachment.bin>


More information about the libcxx-commits mailing list