[Lldb-commits] [PATCH] D76650: Data formatters: fix detection of C strings

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 24 06:57:32 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG177dd63c8d74: Data formatters: fix detection of C strings (authored by jarin, committed by teemperor).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76650/new/

https://reviews.llvm.org/D76650

Files:
  lldb/source/Core/ValueObject.cpp
  lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/Makefile
  lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/TestCstringUnicode.py
  lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/main.cpp


Index: lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/main.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/main.cpp
@@ -0,0 +1,4 @@
+int main() {
+  const char *s = u8"🔥";
+  return 0; // break here
+}
Index: lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/TestCstringUnicode.py
===================================================================
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/TestCstringUnicode.py
@@ -0,0 +1,18 @@
+# coding=utf8
+
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class CstringUnicodeTestCase(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test_cstring_unicode(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(self, "// break here",
+            lldb.SBFileSpec("main.cpp", False))
+        self.expect_expr("s", result_summary='"🔥"')
+        self.expect_expr("(const char*)s", result_summary='"🔥"')
Index: lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
Index: lldb/source/Core/ValueObject.cpp
===================================================================
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -764,7 +764,7 @@
     return true;
   addr_t cstr_address = LLDB_INVALID_ADDRESS;
   AddressType cstr_address_type = eAddressTypeInvalid;
-  cstr_address = GetAddressOf(true, &cstr_address_type);
+  cstr_address = GetPointerValue(&cstr_address_type);
   return (cstr_address != LLDB_INVALID_ADDRESS);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76650.252304.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200324/8f70792b/attachment-0001.bin>


More information about the lldb-commits mailing list