[Lldb-commits] [RFC] Type lookup for template types is broken...

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed May 9 00:30:05 PDT 2018


I think we should fix lldb to reconstruct the full name based on the
information from the dwarf. Right now, it seems both clang and gcc provide
enough information to do this. If we start doing that, then it should also
be fairly easy to implement some kind of fancy formatting (like we spoke
about in the demangler thread), where we elide some information for deeply
nested templates. Who knows, maybe the removal of long <params> lists will
also save some space in the dwarf.

On Tue, 8 May 2018 at 18:35, Adrian Prantl via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

> I made a small experiment where I manually edited the DW_AT_name in the
assembler output:


> Baseline:

> $ lldb with_params
> (lldb) target create "with_params"
> (lldb) b 5
> (lldb) r
> Process 28369 stopped
> * thread #1, name = 'with_params', stop reason = breakpoint 1.1
>      frame #0: 0x00000000004004fc with_params`main(argc=1,
argv=0x00007fffffffe578) at template.cpp:5
>     2
>     3    int main(int argc, char **argv) {
>     4      MyC<int> c = {23};
> -> 5      return c.t;
>     6    }
> Target 0: (with_params) stopped.
> (lldb) p c
> (MyC<int>) $0 = (t = 23)
> ^^^^^^^^^^


> Without the parameters:


> $ lldb no_params
> (lldb) target create "no_params"
> (lldb) b 5
> * thread #1, name = 'no_params', stop reason = breakpoint 1.1
>      frame #0: 0x00000000004004fc no_params`main(argc=1,
argv=0x00007fffffffe588) at template.cpp:5
>     2
>     3    int main(int argc, char **argv) {
>     4      MyC<int> c = {23};
> -> 5      return c.t;
>     6    }
> Target 0: (no_params) stopped.
> (lldb) p c
> (MyC) $0 = (t = 23)
> ^^^^^


> Note how lldb uses the typename to print the result type of the
expression.

> -- adrian
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list