0

Suppose I've this code:

#include "map"
#include "string"
using namespace std;
int main () {
    map<string, string> m = {{"1", "2"}};
    return 0;
}

If I set BP at "return 0" and when it's hit, local windows shows:

std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > m <complex data type>

On the other hand, in gdb windows, "p m" can print out "$1 = std::map with 1 element = {["1"] = "2"}". Speedbar can shows the correct value too.

When gdb debugging, can local window in emacs show c++ object's value correct, same as speedbar?

(Speedbar is not convenient because I need manually add/remove data.)

Thanks.

kgflying
  • 141
  • 4
  • Ref your code: "map" and "string" are system includes files, it should be ```#include ```(similar for string) unless you may have a special reason to store them locally in your project's folder. Does your program compile ok? – Ian Mar 22 '19 at 08:06
  • @Ian The code compiles. `#include ` just means that only the system directories are searched for "map". `#include "map"` searches **more** directories than `#include `. – Tobias Mar 22 '19 at 12:05
  • It does not matter if "" or <>. Thanks. – kgflying Mar 22 '19 at 22:35
  • Looking around. Seems by design for now. Pls see https://emacs.stackexchange.com/questions/47908/gdb-mi-displaying-complex-data-types – kgflying Aug 05 '19 at 18:53

0 Answers0