1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
44 helper_init_error // SymInitialize failed (Windows only) |
44 helper_init_error // SymInitialize failed (Windows only) |
45 }; |
45 }; |
46 |
46 |
47 // decode an pc address to corresponding function name and an offset from the beginning of |
47 // decode an pc address to corresponding function name and an offset from the beginning of |
48 // the function |
48 // the function |
|
49 // |
|
50 // Note: the 'base' variant does not demangle names. The |
|
51 // demangling that was done systematically in the 'modulepath' variant |
|
52 // is now optional. |
49 virtual bool decode(address pc, char* buf, int buflen, int* offset, |
53 virtual bool decode(address pc, char* buf, int buflen, int* offset, |
50 const char* modulepath = NULL) = 0; |
54 const char* modulepath = NULL, bool demangle = true) = 0; |
51 virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) = 0; |
55 virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) = 0; |
52 |
56 |
53 // demangle a C++ symbol |
57 // demangle a C++ symbol |
54 virtual bool demangle(const char* symbol, char* buf, int buflen) = 0; |
58 virtual bool demangle(const char* symbol, char* buf, int buflen) = 0; |
55 // if the decoder can decode symbols in vm |
59 // if the decoder can decode symbols in vm |
79 } |
83 } |
80 |
84 |
81 ~NullDecoder() {}; |
85 ~NullDecoder() {}; |
82 |
86 |
83 virtual bool decode(address pc, char* buf, int buflen, int* offset, |
87 virtual bool decode(address pc, char* buf, int buflen, int* offset, |
84 const char* modulepath = NULL) { |
88 const char* modulepath, bool demangle) { |
85 return false; |
89 return false; |
86 } |
90 } |
87 |
91 |
88 virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) { |
92 virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) { |
89 return false; |
93 return false; |
99 }; |
103 }; |
100 |
104 |
101 |
105 |
102 class Decoder : AllStatic { |
106 class Decoder : AllStatic { |
103 public: |
107 public: |
104 static bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL); |
108 static bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL, bool demangle = true); |
|
109 static bool decode(address pc, char* buf, int buflen, int* offset, bool demangle) { |
|
110 return decode(pc, buf, buflen, offset, (const char*) NULL, demangle); |
|
111 } |
105 static bool decode(address pc, char* buf, int buflen, int* offset, const void* base); |
112 static bool decode(address pc, char* buf, int buflen, int* offset, const void* base); |
106 static bool demangle(const char* symbol, char* buf, int buflen); |
113 static bool demangle(const char* symbol, char* buf, int buflen); |
107 static bool can_decode_C_frame_in_vm(); |
114 static bool can_decode_C_frame_in_vm(); |
108 |
115 |
109 // shutdown shared instance |
116 // shutdown shared instance |