[lldb-dev] std::vector formatter question

Ted Woodward via lldb-dev lldb-dev at lists.llvm.org
Fri Mar 24 09:29:58 PDT 2017


On standalone Hexagon (no OS support), we use Dinkumware for the c/c++
library. LLDB isn't able to print out values of a vector:

Process 1 stopped
* thread #1: tid = 0x0001, 0x0000519c vector.elf`main + 76 at vector.cpp:10,
stop reason = step in
    frame #0: 0x0000519c vector.elf`main + 76 at vector.c:10
   7            vector<int> v;
   8            v.push_back(2);
   9            v.push_back(1);
-> 10           cout << v[0] << " " << v[1] << endl;
   11           return 0;
   12   }
 (lldb) fr v v
(std::vector<int, std::allocator<int> >) v = size=0 {}

When I run on x86 linux built with gcc, I get:
(lldb) fr v v
(std::vector<int, std::allocator<int> >) v = size=2 {
  [0] = 2
  [1] = 1
}


My guess is Dinkumware's vector type is just a little bit different from
libstdc++/libcxx, so the standard formatters don't do the right thing. Where
are the vector<int> formatters defined, and how does LLDB determine which
one to use?


--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project




More information about the lldb-dev mailing list