lldb显示奇怪的std :: strings(macOS) [英] lldb shows wierd std::strings (macOS)

查看:275
本文介绍了lldb显示奇怪的std :: strings(macOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一些麻烦 lldb在我的 CEF FileHandler

I have some troubles getting lldb to show me a correct string output in my CEF FileHandler

当我调试使用 clang-5.0.1(llvm与brew安装) 使用调试器lldb:

When I debug this application built with clang-5.0.1 (llvm install with brew) with the debugger lldb:

[ 96%] Building CXX object gui/executionGraphGui/CMakeFiles/ExecutionGraphGUI.dir/cefapp/FileSchemeHandlerFactory.cpp.o
/usr/local/opt/llvm/bin/clang++   -I/Users/gabrielnuetzi/Desktop/ExecutionGraph/gui/executionGraphGui -I/Users/gabrielnuetzi/Desktop/ExecutionGraph/include -I/Users/gabrielnuetzi/Desktop/ExecutionGraph/build/include -I/usr/local/include/eigen3 -I/Users/gabrielnuetzi/Desktop/ExecutionGraph/build/src/meta/include -I/Users/gabrielnuetzi/Desktop/ExecutionGraph/build/external/args-src -I/Users/gabrielnuetzi/Desktop/ExecutionGraph/build/external/cefbinaries-src -I/Users/gabrielnuetzi/Desktop/ExecutionGraph/build/external/cefbinaries-src/include  -g -arch x86_64 -mmacosx-version-min=10.9   -std=c++14 -lc++experimental -ferror-limit=50 -Werror=return-type -g -g3 -fno-omit-frame-pointer -Weverything -Wpedantic -Wno-deprecated-register -Wno-documentation -Wno-old-style-cast -Wno-comment -Wno-float-equal -Wno-deprecated -Wno-c++98-compat-pedantic -Wno-undef -Wno-unused-macros -fsanitize=leak -fsanitize=address -o CMakeFiles/ExecutionGraphGUI.dir/cefapp/FileSchemeHandlerFactory.cpp.o -c /Users/gabrielnuetzi/Desktop/ExecutionGraph/gui/executionGraphGui/cefapp/FileSchemeHandlerFactory.cpp

来源是:

std::string t = "client://executionGraph/index.html";
std::string temp = CefString(urlParts.path.str).ToString();

我只看到非常奇怪的输出,例如:

I only see really weird output, such as:

Process 3741 stopped
* thread #22, name = 'Chrome_IOThread', stop reason = breakpoint 1.1
    frame #0: 0x000000010011eb09 ExecutionGraphGUI`FileSchemeHandlerFactory::Create(this=0x00006060000dc340, scheme_name=0x0000700007ac9c18, request=(ptr_ = 0x0000700007ac9c10)) at FileSchemeHandlerFactory.cpp:37
   34           ...
-> 37           std::string t = "client://executionGraph/index.html";
   38           ...

Process 3741 launched: '/Users/gabrielnuetzi/Desktop/ExecutionGraph/build/gui/executionGraphGui/Debug/ExecutionGraphGUI.app/Contents/MacOS/ExecutionGraphGUI' (x86_64)
(lldb) fr v t
(std::__1::string) t = "\x85\xac\a\0p\0\0\x10\x85\xac\a\0p\0\0�\a\0p\0\0\xa0\x83\xac\a\0p\0\0`\x83\xac\a\0p\0\0@"

为什么会这样?或者问题出在哪里,格式设置错误?我真的很难弄清楚为什么我无法在应用程序中成功调试这些字符串. 上面的示例是通过从终端启动lldb来完成的.在一个像这样的普通main.cpp应用程序中这里, 一切正常,字符串正常格式化.

Why this behavior?, or where could the problem be, wrong formatters? I have a really hard time to figure out why I cannot successfully debug theses strings in my application. The above example has been done by launching lldb from the terminal. In a normal main.cpp Application like the one here, everything works and the strings are formatted normally.

还要加载格式化程序代码 type summary add -P std::__1::string的帮助无效!

Also loading a formatter code by type summary add -P std::__1::string does not help!

任何帮助都非常欢迎!

fr v -R t 的输出:

Output of fr v -R t:

(lldb) fr v -R t
(std::__1::string) t = {
  __r_ = {
    std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false> = {
      __value_ = {
         = {
          __l = {
            __cap_ = 123145431056880
            __size_ = 123145431056816
            __data_ = 0x0000700007ac8080
          }
          __s = {
             = {
              __size_ = '\xf0'
              __lx = '\xf0'
            }
            __data_ = {
              [0] = '\x81'
              [1] = '\xac'
              [2] = '\a'
              [3] = '\0'
              [4] = 'p'
              [5] = '\0'
              [6] = '\0'
              [7] = '\xb0'
              [8] = '\x81'
              [9] = '\xac'
              [10] = '\a'
              [11] = '\0'
              [12] = 'p'
              [13] = '\0'
              [14] = '\0'
              [15] = '\x80'
              [16] = '\x80'
              [17] = '\xac'
              [18] = '\a'
              [19] = '\0'
              [20] = 'p'
              [21] = '\0'
              [22] = '\0'
            }
          }
          __r = {
            __words = {
              [0] = 123145431056880
              [1] = 123145431056816
              [2] = 123145431056512
            }
          }
        }
      }
    }
  }
}

推荐答案

经过一些调试,我发现 -fsanitize=address导致此问题:没有这些,调试是按预期进行的.这是一种解决方法,我不知道如何与消毒剂一起使用...?

After some debugging I've found out that -fsanitize=address is causing this issue: With out these, the debugging is as expected. This is a workaround and I don't understand how to make it work with the sanitizers...?

这篇关于lldb显示奇怪的std :: strings(macOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆