<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">To be honest, my favorite approach would be to modify clang’s TypePrinter to do this, and then hooking up GetDisplayTypeName() to use whatever flags would be necessary to invoke that bit of magic</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Aug 6, 2015, at 2:33 PM, Siva Chandra <<a href="mailto:sivachandra@google.com" class="">sivachandra@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">FWIW, GDB has a similar concept called type-printers:<br class=""><a href="https://sourceware.org/gdb/current/onlinedocs/gdb/Type-Printing-API.html" class="">https://sourceware.org/gdb/current/onlinedocs/gdb/Type-Printing-API.html</a><br class=""><br class="">On Thu, Aug 6, 2015 at 2:24 PM, Siva Chandra <sivachandra@google.com> wrote:<br class=""><blockquote type="cite" class="">Hi Enrico,<br class=""><br class="">I was thinking about the same issue today. Could we add a concept<br class="">called "TypeNameModifier" and provide ability to define modifiers in<br class="">scripts and command line? With this, a name like<br class="">std::__1::basic_string<...> can be modified into a more friendly name<br class="">like std::string? We could ofcourse have more complex modifications.<br class=""><br class="">I think it is doable, but what is your (and the community's) opinion<br class="">about adding such a feature? If you are OK, I would like to take up<br class="">adding such a feature.<br class=""><br class="">Thanks,<br class="">Siva Chandra<br class=""><br class="">On Thu, Aug 6, 2015 at 2:15 PM, Enrico Granata via lldb-dev<br class=""><lldb-dev@lists.llvm.org> wrote:<br class=""><blockquote type="cite" class="">Hi Eugene,<br class=""><br class="">On Aug 6, 2015, at 2:02 PM, Eugene Birukov via lldb-dev<br class=""><lldb-dev@lists.llvm.org> wrote:<br class=""><br class="">Hi,<br class=""><br class="">I am using LLDB C++ API to create custom debugger and trying to dump<br class="">variables with their types. To do that I am using SBValue.GetTypeName() API.<br class="">Some types are OK, but some others - especially ones related to STL - are<br class="">quite unreadable:<br class=""><br class=""><br class="">those type names are the actual fully-specialized STL type names. I am not<br class="">sure how to control GDB to stop truncating your string formatting, but after<br class="">the “…” there actually is more text<br class="">It looks like what you have is std::unique_ptr<std::vector<std::string> > ><br class="">and those templates all take more arguments which are defaulted so you don’t<br class="">have to type them in code - but are reflected in the type name<br class=""><br class="">(gdb) p value.GetTypeName()<br class="">$1 = 0x7fffe419be40<br class="">"std::__1::unique_ptr<std::__1::vector<std::__1::basic_string<char,<br class="">std::__1::char_traits<char>, std::__1::allocator<char> >,<br class="">std::__1::allocator<std::__1::basic_string<char,<br class="">std::__1::char_traits<char"...<br class="">(gdb) p value.GetDisplayTypeName()<br class="">$2 = 0x7fffe419be40<br class="">"std::__1::unique_ptr<std::__1::vector<std::__1::basic_string<char,<br class="">std::__1::char_traits<char>, std::__1::allocator<char> >,<br class="">std::__1::allocator<std::__1::basic_string<char,<br class="">std::__1::char_traits<char"...<br class="">(gdb)<br class=""><br class=""><br class="">So, is there any way to convert them into some more human-friendly form?<br class=""><br class=""><br class="">Not currently. What one would have to do is hook into the C++ type printing<br class="">logic such that it would know to leave out these extra template arguments<br class="">when they have a default value<br class=""><br class=""><br class="">Thanks,<br class="">Eugene<br class="">_______________________________________________<br class="">lldb-dev mailing list<br class="">lldb-dev@lists.llvm.org<br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""><br class=""><br class=""><br class="">Thanks,<br class="">- Enrico<br class="">📩 egranata@.com ️ 27683<br class=""><br class=""><br class="">_______________________________________________<br class="">lldb-dev mailing list<br class="">lldb-dev@lists.llvm.org<br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""><br class=""></blockquote></blockquote></div></div></blockquote></div><br class=""><div class="">
<div class="" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline">Thanks,</div><div class="" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><i class="">- Enrico</i><br class="">📩 egranata@<font color="#ff2600" class=""></font>.com ☎️ 27683</div>
</div>
<br class=""></body></html>