[Lldb-commits] [lldb] [LLDB] Fix type formatting empty c-strings (PR #68924)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 12 13:29:23 PDT 2023


================
@@ -19,6 +19,21 @@ def getFormatted(self, format, expr):
         self.assertTrue(result.Succeeded(), result.GetError())
         return result.GetOutput()
 
+    @no_debug_info_test
+    @skipIfWindows
+    def testAllPlatforms(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(
+            self, "// break here", lldb.SBFileSpec("main.cpp")
+        )
+        # We can dump correctly non char* c-strings with explicit formatting.
+        self.assertIn(' = ""', self.getFormatted("c-string", "void_empty_cstring"))
----------------
clayborg wrote:

Do we want to do this via the API? Something like:
```
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
frame = thread.GetFrameAtIndex(0)
v = frame.FindVariable('void_empty_cstring')
self.assertEq(v.GetSummary(), '')
v = frame.FindVariable('empty_cstring')
self.assertEq(v.GetSummary(), '')
```

https://github.com/llvm/llvm-project/pull/68924


More information about the lldb-commits mailing list