Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/dbgext/j9dbgext.h
5986 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2017 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#ifndef j9dbgext_h
24
#define j9dbgext_h
25
26
#include <setjmp.h>
27
28
#define TARGET_NNSRP_GET(field, type) ((type) (((U_8 *) dbgLocalToTarget(&(field))) + (field)))
29
#define TARGET_SRP_GET(field, type) ((field) ? TARGET_NNSRP_GET(field, type) : NULL)
30
#define LOCAL_NNSRP_GET(field, type) ((type) (((U_8 *)(&(field))) + (field)))
31
#define LOCAL_SRP_GET(field, type) ((field) ? LOCAL_NNSRP_GET(field, type) : NULL)
32
33
#define TARGET_NNWSRP_GET(field, type) ((type) (((U_8 *) dbgLocalToTarget(&(field))) + (field)))
34
#define TARGET_WSRP_GET(field, type) ((field) ? TARGET_NNWSRP_GET(field, type) : NULL)
35
#define LOCAL_NNWSRP_GET(field, type) ((type) (((U_8 *)(&(field))) + (field)))
36
#define LOCAL_WSRP_GET(field, type) ((field) ? LOCAL_NNWSRP_GET(field, type) : NULL)
37
38
#ifndef DONT_REDIRECT_SRP
39
#ifdef NNSRP_GET
40
#error NNSRP_GET is already defined. #include "dbgext.h" must appear above #include "j9.h"
41
#else
42
#define NNSRP_GET(field, type) TARGET_NNSRP_GET(field, type)
43
#endif
44
45
#ifdef NNWSRP_GET
46
#error NNWSRP_GET is already defined. #include "dbgext.h" must appear above #include "j9.h"
47
#else
48
#define NNWSRP_GET(field, type) TARGET_NNWSRP_GET(field, type)
49
#endif
50
51
#define J9DBG_AVL_SRP_GETNODE(node) ((J9AVLTreeNode *)(AVL_GETNODE(node) ? ((((U_8 *) dbgLocalToTarget(&(node))) + (J9WSRP)(AVL_GETNODE(node)))) : NULL))
52
53
#endif
54
55
#define DBGEXT_READFROMMEMORY 0
56
#define DBGEXT_READFROMCOREFILE 1
57
58
#include "j9.h"
59
60
/* redefine thread functions */
61
#include "../thread/omrthreadinspect.h"
62
#include "dbgext_internal.h"
63
64
/* the following macros may be used for error handling within debug extensions.
65
* e.g
66
* DBG_TRY {
67
* doSomethingRisky();
68
* } DBG_CATCH {
69
* dbgPrint("An error occurred\n");
70
* } DBG_FINALLY;
71
*
72
* All three macros MUST be used.
73
* Code MUST NOT return from the TRY block, or exit it in any other abnormal way (e.g. break, continue, goto)
74
*/
75
76
typedef struct {
77
jmp_buf buf;
78
} DBG_JMPBUF;
79
80
#define DBG_TRY do { \
81
DBG_JMPBUF dbgJmpbuf; \
82
DBG_JMPBUF *dbgOldHandler = dbgSetHandler(&dbgJmpbuf); \
83
int dbgSetjmpResult = setjmp(dbgJmpbuf.buf); \
84
if (dbgSetjmpResult == 0)
85
#define DBG_CATCH \
86
dbgSetHandler(dbgOldHandler); \
87
if (dbgSetjmpResult != 0)
88
#define DBG_FINALLY } while (0)
89
90
#ifdef __cplusplus
91
extern "C" {
92
#endif
93
94
void dbgext_walkj9pool(const char *args);
95
96
J9PortLibrary * dbgGetPortLibrary(void);
97
98
void dbgUnmapPool (J9Pool *pool);
99
J9Pool *dbgMapPool (UDATA addr);
100
extern void dbgPrint (const char* message, ...);
101
extern void dbgReadMemory (UDATA address, void *structure, UDATA size, UDATA *bytesRead);
102
extern UDATA dbgReadSlot (UDATA srcaddr, UDATA size);
103
extern UDATA dbgGetExpression (const char* args);
104
extern void dbgSetVerboseMode(int verboseMode);
105
extern I_32 dbg_j9port_create_library(J9PortLibrary *portLib, J9PortLibraryVersion *version, UDATA size);
106
107
#ifdef __cplusplus
108
} /* extern "C" */
109
#endif
110
111
#endif /* j9dbgext_h */
112
113
114
115