diff options
Diffstat (limited to 'development')
-rw-r--r-- | development/c++filt.html | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/development/c++filt.html b/development/c++filt.html index b6065fe..3c69659 100644 --- a/development/c++filt.html +++ b/development/c++filt.html @@ -178,12 +178,43 @@ <main> <h1 id="cfilt1"><a class="header" href="#cfilt1">c++filt(1)</a></h1> <h2 id="demangle-symbol"><a class="header" href="#demangle-symbol">Demangle symbol</a></h2> -<pre><code class="language-markdown"> c++-filt <symbol_str> +<pre><code class="language-markdown"> c++-filt [opts] <symbol_str> + -t Try to also demangle types. </code></pre> <h2 id="demangle-stream"><a class="header" href="#demangle-stream">Demangle stream</a></h2> <p>For example dynamic symbol table:</p> <pre><code class="language-markdown"> readelf -W --dyn-syms <elf> | c++filt </code></pre> +<h2 id="demangle-types"><a class="header" href="#demangle-types">Demangle types</a></h2> +<pre><code class="language-c++">// file: type.cc +#include <cstdio> +#include <typeinfo> + +#define P(ty) printf(#ty " -> %s\n", typeid(ty).name()) + +template <typename T = void> +struct Foo {}; + +int main() { + P(int); + P(unsigned char); + P(Foo<>); + P(Foo<int>); +} +</code></pre> +<p>Build and run:</p> +<pre><code class="language-sh">$ clang++ type.cc && ./a.out | c++filt +int -> i +unsigned char -> h +Foo<> -> 3FooIvE +Foo<int> -> 3FooIiE + +$ clang++ type.cc && ./a.out | c++filt -t +int -> int +unsigned char -> unsigned char +Foo<> -> Foo<void> +Foo<int> -> Foo<int> +</code></pre> </main> |