Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1326)

Side by Side Diff: base/third_party/symbolize/demangle.h

Issue 545148: Import google-glog's Symbolize() and use it in debug_util_posix.cc. (Closed)
Patch Set: Fix checkdeps.py error Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2006, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // Author: Satoru Takabayashi
31 //
32 // An async-signal-safe and thread-safe demangler for Itanium C++ ABI
33 // (aka G++ V3 ABI).
34
35 // The demangler is implemented to be used in async signal handlers to
36 // symbolize stack traces. We cannot use libstdc++'s
37 // abi::__cxa_demangle() in such signal handlers since it's not async
38 // signal safe (it uses malloc() internally).
39 //
40 // Note that this demangler doesn't support full demangling. More
41 // specifically, it doesn't print types of function parameters and
42 // types of template arguments. It just skips them. However, it's
43 // still very useful to extract basic information such as class,
44 // function, constructor, destructor, and operator names.
45 //
46 // See the implementation note in demangle.cc if you are interested.
47 //
48 // Example:
49 //
50 // | Mangled Name | The Demangler | abi::__cxa_demangle()
51 // |---------------|---------------|-----------------------
52 // | _Z1fv | f() | f()
53 // | _Z1fi | f() | f(int)
54 // | _Z3foo3bar | foo() | foo(bar)
55 // | _Z1fIiEvi | f<>() | void f<int>(int)
56 // | _ZN1N1fE | N::f | N::f
57 // | _ZN3Foo3BarEv | Foo::Bar() | Foo::Bar()
58 // | _Zrm1XS_" | operator%() | operator%(X, X)
59 // | _ZN3FooC1Ev | Foo::Foo() | Foo::Foo()
60 // | _Z1fSs | f() | f(std::basic_string<char,
61 // | | | std::char_traits<char>,
62 // | | | std::allocator<char> >)
63 //
64 // See the unit test for more examples.
65 //
66 // Note: we might want to write demanglers for ABIs other than Itanium
67 // C++ ABI in the future.
68 //
69
70 #ifndef BASE_DEMANGLE_H_
71 #define BASE_DEMANGLE_H_
72
73 #include "config.h"
74
75 _START_GOOGLE_NAMESPACE_
76
77 // Demangle "mangled". On success, return true and write the
78 // demangled symbol name to "out". Otherwise, return false.
79 // "out" is modified even if demangling is unsuccessful.
80 bool Demangle(const char *mangled, char *out, int out_size);
81
82 _END_GOOGLE_NAMESPACE_
83
84 #endif // BASE_DEMANGLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698