Path: blob/master/runtime/jextractnatives/jextractglue.c
5986 views
/*******************************************************************************1* Copyright (c) 1991, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122#include "j9dbgext.h"23#include "j9comp.h"24#include "j9protos.h"25#include "jextractnatives_internal.h"26#include <string.h>27#include <ctype.h>2829static char const notVisibleMsg[] =30"Error: J9SIZEOF_%s was not visible at compile time.\n"31"To fix this, add %s to cVisibleStructs (j9.h) and recompile %s\n"32"\n"33"(or if %s is in a different header, include that header in %s).";3435#define PRINT_NOT_VISIBLE_MSG(x) \36dbgPrint(notVisibleMsg, (x), (x), __FILE__, (x), __FILE__)3738void39run_command(const char *cmd)40{41size_t len = 0;42const char *options = NULL;4344while (('\0' != cmd[len]) && !isspace(cmd[len])) {45len += 1;46}4748options = cmd + len;49while (isspace(*options)) {50options += 1;51}5253#define IsCommand(command) \54(((sizeof(command) - 1) == len) && \55(memcmp(cmd, (command), len) == 0))5657if (IsCommand("!j9help")) {58dbgext_j9help(options);59} else if (IsCommand("!findvm")) {60dbgext_findvm(options);61} else if (IsCommand("!setvm")) {62dbgext_setvm(options);63} else {64dbgPrint("Unknown J9 plugin command %s\n", cmd);65}6667#undef IsCommand68}697071