Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python lldb中STL的漂亮打印机_Python_Stl_Gdb_Pretty Print_Lldb - Fatal编程技术网

Python lldb中STL的漂亮打印机

Python lldb中STL的漂亮打印机,python,stl,gdb,pretty-print,lldb,Python,Stl,Gdb,Pretty Print,Lldb,GDB7有一些有用的用于STL结构的python脚本 lldb是否有类似的工具? 即使使用简单的地图或向量,所显示的信息也相当神秘 -> 100 h->moveReceivedSummaries(summaries); 101 auto res = h->moveReceivedSummaries(); 102 EXPECT_TRUE(*summary == *res[1].get()); 103 } (lldb) p summ

GDB7有一些有用的用于STL结构的python脚本

lldb是否有类似的工具? 即使使用简单的地图或向量,所显示的信息也相当神秘

-> 100      h->moveReceivedSummaries(summaries);
   101      auto res = h->moveReceivedSummaries();
   102      EXPECT_TRUE(*summary == *res[1].get());
   103  }
(lldb) p summaries
(std::__1::map<int, std::__1::unique_ptr<ContextSummary, std::__1::default_delete<ContextSummary> >, std::__1::less<int>, std::__1::allocator<std::__1::pair<const int, std::__1::unique_ptr<ContextSummary, std::__1::default_delete<ContextSummary> > > > >) $0 = size=1 {
  (std::__1::__tree_node<std::__1::pair<int, std::__1::unique_ptr<ContextSummary, std::__1::default_delete<ContextSummary> > >, void *>::value_type) [0] = {
    (int) first = 1
    (std::__1::unique_ptr<ContextSummary, std::__1::default_delete<ContextSummary> >) second = {
      (std::__1::__compressed_pair<ContextSummary *, std::__1::default_delete<ContextSummary> >) __ptr_ = {
        (std::__1::__libcpp_compressed_pair_imp<ContextSummary *, std::__1::default_delete<ContextSummary> >) std::__1::__libcpp_compressed_pair_imp<ContextSummary *, std::__1::default_delete<ContextSummary> > = {
          (ContextSummary *) __first_ = 0x0000000100308390
        }
      }
    }
  }
}
->100小时->移动接收摘要(摘要);
101自动恢复=h->moveReceivedSummaries();
102 EXPECT_TRUE(*summary==*res[1].get());
103  }
(lldb)p摘要
(标准:地图)$0=size=1{
(std::u 1::u树节点::值类型)[0]={
(int)first=1
(std::_1::唯一_ptr)秒={
(std::uuu 1::uuu压缩对)uuu ptr={
(std:::uuu1::uuu libcpp\u compressed\u pair\u imp)std::u1::uuu libcpp\u compressed\u pair\u imp={
(上下文摘要*)\uuuuu first=0x0000000100308390
}
}
}
}
}

> P>最初的漂亮打印机的焦点更多的是在AcKIT/UIKIT类型中用于Mac/iOS应用程序开发,现在正在添加C++格式。例如,Xcode 4.6.3:

(lldb) p string_map
(StringMapT) $0 = size=2 {
  (std::__1::__tree_node<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void *>::value_type) [0] = {
    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) first = "hi"
    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) second = "there"
  }
  (std::__1::__tree_node<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void *>::value_type) [1] = {
    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) first = "this"
    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) second = "that"
  }
}
<>记住,在Mac OS X上有两个常用的C++库版本——GNU LIbSTDC++ +库和更新的LLVM LICBXX库,它将C++ 11(V)。这两个库中的每一个都需要不同的数据格式化程序


lldb有一种丰富的扩展语言,用于添加您自己的类型格式化程序,可以指定要打印的现有元素,也可以调用Python来格式化要打印的类型。目标是让内置格式化程序处理常见的C++/Objective-C类型,但如果您愿意编写自己的格式化程序,则不限于lldb提供的类型。有关更多信息,请参阅。

我认为最简单的解决方案可能是在使用Mac OS X时使用Xcode

在lldb中的following()中,在从下载python脚本之后,我尝试使用
命令脚本import../libcxx.py

然而,结果是一样的

(lldb) p v
(std::__1::vector<std::__1::unique_ptr<A, std::__1::default_delete<A> >, std::__1::allocator<std::__1::unique_ptr<A, std::__1::default_delete<A> > > >) $4 = size=0 {
  [0] = {
    __ptr_ = {
      std::__1::__libcpp_compressed_pair_imp<A *, std::__1::default_delete<A> > = {
        __first_ = 0x0000000100200000
      }
    }
  }
}
(lldb)p v
(标准:向量)$4=size=0{
[0] = {
__ptr_uuz={
std::_1::_libcpp_compressed_pair_imp={
__第一个=0x0000000100200000
}
}
}
}

libcxx.py脚本确实帮助了我。然而,这种联系似乎不再正确:现在应该是这样。
(lldb) p v
(std::__1::vector<std::__1::unique_ptr<A, std::__1::default_delete<A> >, std::__1::allocator<std::__1::unique_ptr<A, std::__1::default_delete<A> > > >) $4 = size=0 {
  [0] = {
    __ptr_ = {
      std::__1::__libcpp_compressed_pair_imp<A *, std::__1::default_delete<A> > = {
        __first_ = 0x0000000100200000
      }
    }
  }
}