Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/jextractnatives/jextractglue.c
5986 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2021 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
#include "j9dbgext.h"
24
#include "j9comp.h"
25
#include "j9protos.h"
26
#include "jextractnatives_internal.h"
27
#include <string.h>
28
#include <ctype.h>
29
30
static char const notVisibleMsg[] =
31
"Error: J9SIZEOF_%s was not visible at compile time.\n"
32
"To fix this, add %s to cVisibleStructs (j9.h) and recompile %s\n"
33
"\n"
34
"(or if %s is in a different header, include that header in %s).";
35
36
#define PRINT_NOT_VISIBLE_MSG(x) \
37
dbgPrint(notVisibleMsg, (x), (x), __FILE__, (x), __FILE__)
38
39
void
40
run_command(const char *cmd)
41
{
42
size_t len = 0;
43
const char *options = NULL;
44
45
while (('\0' != cmd[len]) && !isspace(cmd[len])) {
46
len += 1;
47
}
48
49
options = cmd + len;
50
while (isspace(*options)) {
51
options += 1;
52
}
53
54
#define IsCommand(command) \
55
(((sizeof(command) - 1) == len) && \
56
(memcmp(cmd, (command), len) == 0))
57
58
if (IsCommand("!j9help")) {
59
dbgext_j9help(options);
60
} else if (IsCommand("!findvm")) {
61
dbgext_findvm(options);
62
} else if (IsCommand("!setvm")) {
63
dbgext_setvm(options);
64
} else {
65
dbgPrint("Unknown J9 plugin command %s\n", cmd);
66
}
67
68
#undef IsCommand
69
}
70
71