1 /*
2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3  * Copyright (c) 2017, SAP SE. All rights reserved.
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 only, as
8  * published by the Free Software Foundation.
9  *
10  * This code is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * version 2 for more details (a copy is included in the LICENSE file that
14  * accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License version
17  * 2 along with this work; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21  * or visit www.oracle.com if you need additional information or have any
22  * questions.
23  *
24  */
25 
26 #ifndef OS_WINDOWS_VM_SYMBOLENGINE_HPP
27 #define OS_WINDOWS_VM_SYMBOLENGINE_HPP
28 
29 class outputStream;
30 
31 namespace SymbolEngine {
32 
33   bool decode(const void* addr, char* buf, int buflen, int* offset, bool do_demangle);
34 
35   bool demangle(const char* symbol, char *buf, int buflen);
36 
37   // given an address, attempts to retrieve the source file and line number.
38   bool get_source_info(const void* addr, char* filename, size_t filename_len,
39                        int* line_no);
40 
41   // Scan the loaded modules. Add all directories for all loaded modules
42   //  to the current search path, unless they are already part of the search
43   //    path. Prior search path content is preserved, directories are only
44   //   added, never removed.
45   // If p_search_path_was_updated is not NULL, points to a bool which, upon
46   //   successful return from the function, contains true if the search path
47   //   was updated, false if no update was needed because no new DLLs were
48   //   loaded or unloaded.
49   // Returns true for success, false for error.
50   bool recalc_search_path(bool* p_search_path_was_updated = NULL);
51 
52   // Print one liner describing state (if library loaded, which functions are
53   // missing - if any, and the dbhelp API version)
54   void print_state_on(outputStream* st);
55 
56   // Call at DLL_PROCESS_ATTACH.
57   void pre_initialize();
58 
59 };
60 
61 #endif // #ifndef OS_WINDOWS_VM_SYMBOLENGINE_HPP
62 
63 
64