demangle.h
Go to the documentation of this file.
00001 // Copyright 2018 The Abseil Authors.
00002 //
00003 // Licensed under the Apache License, Version 2.0 (the "License");
00004 // you may not use this file except in compliance with the License.
00005 // You may obtain a copy of the License at
00006 //
00007 //      https://www.apache.org/licenses/LICENSE-2.0
00008 //
00009 // Unless required by applicable law or agreed to in writing, software
00010 // distributed under the License is distributed on an "AS IS" BASIS,
00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 // See the License for the specific language governing permissions and
00013 // limitations under the License.
00014 
00015 // An async-signal-safe and thread-safe demangler for Itanium C++ ABI
00016 // (aka G++ V3 ABI).
00017 //
00018 // The demangler is implemented to be used in async signal handlers to
00019 // symbolize stack traces.  We cannot use libstdc++'s
00020 // abi::__cxa_demangle() in such signal handlers since it's not async
00021 // signal safe (it uses malloc() internally).
00022 //
00023 // Note that this demangler doesn't support full demangling.  More
00024 // specifically, it doesn't print types of function parameters and
00025 // types of template arguments.  It just skips them.  However, it's
00026 // still very useful to extract basic information such as class,
00027 // function, constructor, destructor, and operator names.
00028 //
00029 // See the implementation note in demangle.cc if you are interested.
00030 //
00031 // Example:
00032 //
00033 // | Mangled Name  | The Demangler | abi::__cxa_demangle()
00034 // |---------------|---------------|-----------------------
00035 // | _Z1fv         | f()           | f()
00036 // | _Z1fi         | f()           | f(int)
00037 // | _Z3foo3bar    | foo()         | foo(bar)
00038 // | _Z1fIiEvi     | f<>()         | void f<int>(int)
00039 // | _ZN1N1fE      | N::f          | N::f
00040 // | _ZN3Foo3BarEv | Foo::Bar()    | Foo::Bar()
00041 // | _Zrm1XS_"     | operator%()   | operator%(X, X)
00042 // | _ZN3FooC1Ev   | Foo::Foo()    | Foo::Foo()
00043 // | _Z1fSs        | f()           | f(std::basic_string<char,
00044 // |               |               |   std::char_traits<char>,
00045 // |               |               |   std::allocator<char> >)
00046 //
00047 // See the unit test for more examples.
00048 //
00049 // Note: we might want to write demanglers for ABIs other than Itanium
00050 // C++ ABI in the future.
00051 //
00052 
00053 #ifndef ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_
00054 #define ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_
00055 
00056 namespace absl {
00057 namespace debugging_internal {
00058 
00059 // Demangle `mangled`.  On success, return true and write the
00060 // demangled symbol name to `out`.  Otherwise, return false.
00061 // `out` is modified even if demangling is unsuccessful.
00062 bool Demangle(const char *mangled, char *out, int out_size);
00063 
00064 }  // namespace debugging_internal
00065 }  // namespace absl
00066 
00067 #endif  // ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:42:14