|
Packit Service |
9def5d |
// Copyright (c) 2006, Google Inc.
|
|
Packit Service |
9def5d |
// All rights reserved.
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
9def5d |
// modification, are permitted provided that the following conditions are
|
|
Packit Service |
9def5d |
// met:
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// * Redistributions of source code must retain the above copyright
|
|
Packit Service |
9def5d |
// notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
9def5d |
// * Redistributions in binary form must reproduce the above
|
|
Packit Service |
9def5d |
// copyright notice, this list of conditions and the following disclaimer
|
|
Packit Service |
9def5d |
// in the documentation and/or other materials provided with the
|
|
Packit Service |
9def5d |
// distribution.
|
|
Packit Service |
9def5d |
// * Neither the name of Google Inc. nor the names of its
|
|
Packit Service |
9def5d |
// contributors may be used to endorse or promote products derived from
|
|
Packit Service |
9def5d |
// this software without specific prior written permission.
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit Service |
9def5d |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit Service |
9def5d |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit Service |
9def5d |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit Service |
9def5d |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit Service |
9def5d |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit Service |
9def5d |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit Service |
9def5d |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit Service |
9def5d |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit Service |
9def5d |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit Service |
9def5d |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// Author: Satoru Takabayashi
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// An async-signal-safe and thread-safe demangler for Itanium C++ ABI
|
|
Packit Service |
9def5d |
// (aka G++ V3 ABI).
|
|
Packit Service |
9def5d |
|
|
Packit Service |
9def5d |
// The demangler is implemented to be used in async signal handlers to
|
|
Packit Service |
9def5d |
// symbolize stack traces. We cannot use libstdc++'s
|
|
Packit Service |
9def5d |
// abi::__cxa_demangle() in such signal handlers since it's not async
|
|
Packit Service |
9def5d |
// signal safe (it uses malloc() internally).
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// Note that this demangler doesn't support full demangling. More
|
|
Packit Service |
9def5d |
// specifically, it doesn't print types of function parameters and
|
|
Packit Service |
9def5d |
// types of template arguments. It just skips them. However, it's
|
|
Packit Service |
9def5d |
// still very useful to extract basic information such as class,
|
|
Packit Service |
9def5d |
// function, constructor, destructor, and operator names.
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// See the implementation note in demangle.cc if you are interested.
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// Example:
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// | Mangled Name | The Demangler | abi::__cxa_demangle()
|
|
Packit Service |
9def5d |
// |---------------|---------------|-----------------------
|
|
Packit Service |
9def5d |
// | _Z1fv | f() | f()
|
|
Packit Service |
9def5d |
// | _Z1fi | f() | f(int)
|
|
Packit Service |
9def5d |
// | _Z3foo3bar | foo() | foo(bar)
|
|
Packit Service |
9def5d |
// | _Z1fIiEvi | f<>() | void f<int>(int)
|
|
Packit Service |
9def5d |
// | _ZN1N1fE | N::f | N::f
|
|
Packit Service |
9def5d |
// | _ZN3Foo3BarEv | Foo::Bar() | Foo::Bar()
|
|
Packit Service |
9def5d |
// | _Zrm1XS_" | operator%() | operator%(X, X)
|
|
Packit Service |
9def5d |
// | _ZN3FooC1Ev | Foo::Foo() | Foo::Foo()
|
|
Packit Service |
9def5d |
// | _Z1fSs | f() | f(std::basic_string
|
|
Packit Service |
9def5d |
// | | | std::char_traits<char>,
|
|
Packit Service |
9def5d |
// | | | std::allocator<char> >)
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// See the unit test for more examples.
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
// Note: we might want to write demanglers for ABIs other than Itanium
|
|
Packit Service |
9def5d |
// C++ ABI in the future.
|
|
Packit Service |
9def5d |
//
|
|
Packit Service |
9def5d |
|
|
Packit Service |
9def5d |
#ifndef BASE_DEMANGLE_H_
|
|
Packit Service |
9def5d |
#define BASE_DEMANGLE_H_
|
|
Packit Service |
9def5d |
|
|
Packit Service |
9def5d |
#include "config.h"
|
|
Packit Service |
9def5d |
#include "glog/logging.h"
|
|
Packit Service |
9def5d |
|
|
Packit Service |
9def5d |
_START_GOOGLE_NAMESPACE_
|
|
Packit Service |
9def5d |
|
|
Packit Service |
9def5d |
// Demangle "mangled". On success, return true and write the
|
|
Packit Service |
9def5d |
// demangled symbol name to "out". Otherwise, return false.
|
|
Packit Service |
9def5d |
// "out" is modified even if demangling is unsuccessful.
|
|
Packit Service |
9def5d |
bool GOOGLE_GLOG_DLL_DECL Demangle(const char *mangled, char *out, int out_size);
|
|
Packit Service |
9def5d |
|
|
Packit Service |
9def5d |
_END_GOOGLE_NAMESPACE_
|
|
Packit Service |
9def5d |
|
|
Packit Service |
9def5d |
#endif // BASE_DEMANGLE_H_
|