1 .\" Copyright (c) 2009,2011 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" This software is provided by Joseph Koshy ``as is'' and
13 .\" any express or implied warranties, including, but not limited to, the
14 .\" implied warranties of merchantability and fitness for a particular purpose
15 .\" are disclaimed. in no event shall Joseph Koshy be liable
16 .\" for any direct, indirect, incidental, special, exemplary, or consequential
17 .\" damages (including, but not limited to, procurement of substitute goods
18 .\" or services; loss of use, data, or profits; or business interruption)
19 .\" however caused and on any theory of liability, whether in contract, strict
20 .\" liability, or tort (including negligence or otherwise) arising in any way
21 .\" out of the use of this software, even if advised of the possibility of
24 .\" $Id: elftc_demangle.3 3645 2018-10-15 20:17:14Z jkoshy $
31 .Nd demangle a C++ name
38 .Fa "const char *encodedname"
41 .Fa "unsigned int flags"
46 decodes a symbol name encoded according to the type encoding rules
47 for the C++ language and returns a string denoting an equivalent
52 specifies the encoded symbol name.
55 denotes a programmer-specified area to place the prototype string in.
58 specifies the size of the programmer-specified area.
61 specifies the encoding style in use for argument
63 Supported encoding styles are:
64 .Bl -tag -width ".Dv ELFTC_DEM_GNU3"
66 The encoding style used by compilers adhering to the conventions of the
67 C++ Annotated Reference Manual.
69 The encoding style by GNU C++ version 2.
71 The encoding style by GNU C++ version 3 and later.
76 may be zero, in which case the function will attempt to guess the
77 encoding scheme from the contents of
83 In case of an error it returns -1 and sets the
87 To decode a name that uses an unknown encoding style use:
88 .Bd -literal -offset indent
92 funcname = ...; /* points to string to be demangled */
93 if (elftc_demangle(funcname, buffer, sizeof(buffer), 0) == 0)
94 printf("Demangled name: %\\n", buffer);
96 perror("Cannot demangle %s", funcname);
101 may fail with the following errors:
102 .Bl -tag -width ".Bq Er ENAMETOOLONG"
106 was not a valid encoded name.
107 .It Bq Er ENAMETOOLONG
108 The output buffer specified by arguments
112 was too small to hold the decoded function prototype.