diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/JextractCommand.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/JextractCommand.java index 1c541bc653c..8e8e10a5ee3 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/JextractCommand.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/JextractCommand.java @@ -28,14 +28,14 @@ import com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException; import com.ibm.j9ddr.tools.ddrinteractive.Command; -public class JextractCommand extends Command +public class JextractCommand extends Command { public JextractCommand() { addCommand("jextract", "", "dump a JExtract file to filename (or console)"); } - public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException + public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException { try { throw new CorruptDataException("command not implemented"); @@ -43,5 +43,4 @@ public void run(String command, String[] args, Context context, PrintStream out) throw new DDRInteractiveCommandException(e); } } - } diff --git a/jcl/src/openj9.dtfj/share/classes/com/ibm/jvm/j9/dump/extract/Main.java b/jcl/src/openj9.dtfj/share/classes/com/ibm/jvm/j9/dump/extract/Main.java index 63d44ebc453..d4169dc12c1 100644 --- a/jcl/src/openj9.dtfj/share/classes/com/ibm/jvm/j9/dump/extract/Main.java +++ b/jcl/src/openj9.dtfj/share/classes/com/ibm/jvm/j9/dump/extract/Main.java @@ -22,13 +22,11 @@ *******************************************************************************/ package com.ibm.jvm.j9.dump.extract; -import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; @@ -276,10 +274,8 @@ public static void main(String[] args) { String outputName = null; File virtualRootDirectory = null; boolean ignoreOptions = false; - boolean interactive = false; boolean verbose = false; boolean throwExceptions = false; - boolean zip = true; boolean disableBuildIdCheck = false; boolean excludeCoreFile = false; @@ -291,8 +287,6 @@ public static void main(String[] args) { if (!ignoreOptions && args[i].startsWith("-")) { //$NON-NLS-1$ if ("--".equals(args[i])) { //$NON-NLS-1$ ignoreOptions = true; - } else if ("-interactive".equals(args[i])) { //$NON-NLS-1$ - interactive = true; } else if ("-help".equals(args[i])) { //$NON-NLS-1$ usageMessage(null, JEXTRACT_SUCCESS); } else if ("-f".equals(args[i])) { //$NON-NLS-1$ @@ -338,14 +332,8 @@ public static void main(String[] args) { Main dumper = new Main(dumpName, virtualRootDirectory, verbose, throwExceptions, disableBuildIdCheck, excludeCoreFile); - if (interactive) { - dumper.runInteractive(); - } else { - if (zip) { - dumper.runZip(outputName); - } - report("jextract complete."); //$NON-NLS-1$ - } + dumper.runZip(outputName); + report("jextract complete."); //$NON-NLS-1$ if (dumper._dump != null) { try { @@ -512,41 +500,6 @@ private void runZip(String outputName) { } } - private void runInteractive() { - report("Jextract interactive mode."); //$NON-NLS-1$ - report("Type '!j9help' for help."); //$NON-NLS-1$ - report("Type 'quit' to quit."); //$NON-NLS-1$ - report("(Commands must be prefixed with '!')"); //$NON-NLS-1$ - - IAbstractAddressSpace addressSpace = _dump.getAddressSpace(); - - if (addressSpace == null) { - report("Error. Address space not found in dump: " + _dumpName //$NON-NLS-1$ - + ". Dump is truncated, corrupted or does not contain a supported JVM."); //$NON-NLS-1$ - return; - } - - BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); - - try { - while (true) { - report("> "); //$NON-NLS-1$ - String command = input.readLine().trim(); - if ("quit".equalsIgnoreCase(command) || "q".equalsIgnoreCase(command)) { //$NON-NLS-1$ //$NON-NLS-2$ - break; - } - try { - doCommand(addressSpace, command); - } catch (Throwable e) { - report(e.getMessage()); - report("Failure detected during command execution, see previous message(s)."); //$NON-NLS-1$ - } - } - } catch (IOException e) { - report("Error reading input."); //$NON-NLS-1$ - } - } - private static void report(String message) { System.err.println(message); } @@ -677,7 +630,4 @@ private static void copy(ClosingFileReader from, OutputStream to, byte[] buffer) } private native long getEnvironmentPointer(IAbstractAddressSpace dump, boolean disableBuildIdCheck) throws Exception; - - private native void doCommand(IAbstractAddressSpace dump, String command) throws Exception; - } diff --git a/runtime/jextractnatives/CMakeLists.txt b/runtime/jextractnatives/CMakeLists.txt index f1989657fd0..0129ea09188 100644 --- a/runtime/jextractnatives/CMakeLists.txt +++ b/runtime/jextractnatives/CMakeLists.txt @@ -23,15 +23,12 @@ set(OMR_ENHANCED_WARNINGS OFF) j9vm_add_library(j9jextract SHARED - jextractglue.c jextractnatives.c - ) target_link_libraries(j9jextract PRIVATE j9vm_interface - j9dbgext j9util j9utilcore @@ -39,7 +36,6 @@ target_link_libraries(j9jextract ) omr_add_exports(j9jextract - Java_com_ibm_jvm_j9_dump_extract_Main_doCommand Java_com_ibm_jvm_j9_dump_extract_Main_getEnvironmentPointer ) diff --git a/runtime/jextractnatives/jextractglue.c b/runtime/jextractnatives/jextractglue.c deleted file mode 100644 index bbf30de2915..00000000000 --- a/runtime/jextractnatives/jextractglue.c +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 1991 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - -#include "j9dbgext.h" -#include "j9comp.h" -#include "j9protos.h" -#include "jextractnatives_internal.h" -#include -#include - -static char const notVisibleMsg[] = - "Error: J9SIZEOF_%s was not visible at compile time.\n" - "To fix this, add %s to cVisibleStructs (j9.h) and recompile %s\n" - "\n" - "(or if %s is in a different header, include that header in %s)."; - -#define PRINT_NOT_VISIBLE_MSG(x) \ - dbgPrint(notVisibleMsg, (x), (x), __FILE__, (x), __FILE__) - -void -run_command(const char *cmd) -{ - size_t len = 0; - const char *options = NULL; - - while (('\0' != cmd[len]) && !isspace(cmd[len])) { - len += 1; - } - - options = cmd + len; - while (isspace(*options)) { - options += 1; - } - -#define IsCommand(command) \ - (((sizeof(command) - 1) == len) && \ - (memcmp(cmd, (command), len) == 0)) - - if (IsCommand("!j9help")) { - dbgext_j9help(options); - } else if (IsCommand("!findvm")) { - dbgext_findvm(options); - } else if (IsCommand("!setvm")) { - dbgext_setvm(options); - } else { - dbgPrint("Unknown J9 plugin command %s\n", cmd); - } - -#undef IsCommand -} diff --git a/runtime/jextractnatives/jextractnatives.c b/runtime/jextractnatives/jextractnatives.c index 5954db11951..d3a15236558 100644 --- a/runtime/jextractnatives/jextractnatives.c +++ b/runtime/jextractnatives/jextractnatives.c @@ -25,7 +25,6 @@ #include "j9dbgext.h" #include "j9protos.h" #include "j9port.h" -#include "jextractnatives_internal.h" #include "j9version.h" #include @@ -289,30 +288,6 @@ cacheIDs(JNIEnv* env, jobject dumpObj) return 0; } -void JNICALL -Java_com_ibm_jvm_j9_dump_extract_Main_doCommand(JNIEnv *env, jobject obj, jobject dumpObj, jstring commandObject) -{ - const char *command = (*env)->GetStringUTFChars(env, commandObject, 0); - PORT_ACCESS_FROM_VMC((J9VMThread*)env); - - if (command == NULL) { - return; - } - - if (cacheIDs(env, dumpObj)) { - return; - } - - /* hook the debug extension's malloc and free up to ours, so that it can benefit from -memorycheck */ - OMRPORT_FROM_J9PORT(dbgGetPortLibrary())->mem_allocate_memory = OMRPORT_FROM_J9PORT(PORTLIB)->mem_allocate_memory; - OMRPORT_FROM_J9PORT(dbgGetPortLibrary())->mem_free_memory = OMRPORT_FROM_J9PORT(PORTLIB)->mem_free_memory; - OMRPORT_FROM_J9PORT(dbgGetPortLibrary())->port_control = OMRPORT_FROM_J9PORT(PORTLIB)->port_control; - - run_command(command); - - (*env)->ReleaseStringUTFChars(env, commandObject, command); -} - /** * Gets the environment pointer from the J9RAS structure. */ diff --git a/runtime/jextractnatives/jextractnatives_internal.h b/runtime/jextractnatives/jextractnatives_internal.h deleted file mode 100644 index 0219b0cae9e..00000000000 --- a/runtime/jextractnatives/jextractnatives_internal.h +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 1991 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - -#ifndef jextractnatives_internal_h -#define jextractnatives_internal_h - -/** -* @file jextractnatives_internal.h -* @brief Internal prototypes used within the JEXTRACTNATIVES module. -* -* This file contains implementation-private function prototypes and -* type definitions for the JEXTRACTNATIVES module. -*/ - -#include "j9.h" -#include "j9comp.h" -#include "jextractnatives_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void run_command(const char *cmd); - -#ifdef __cplusplus -} -#endif - -#endif /* jextractnatives_internal_h */ diff --git a/runtime/jextractnatives/module.xml b/runtime/jextractnatives/module.xml index 690b206a9e0..9e96c80d20d 100644 --- a/runtime/jextractnatives/module.xml +++ b/runtime/jextractnatives/module.xml @@ -23,7 +23,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/runtime/oti/jextractnatives_api.h b/runtime/oti/jextractnatives_api.h index 97b747f2cbd..f47c6cf7a96 100644 --- a/runtime/oti/jextractnatives_api.h +++ b/runtime/oti/jextractnatives_api.h @@ -44,17 +44,6 @@ extern "C" { /* ---------------- jextractnatives.c ---------------- */ -/** -* @brief -* @param *env -* @param obj -* @param dumpObj -* @param commandObject -* @return void -*/ -void JNICALL -Java_com_ibm_jvm_j9_dump_extract_Main_doCommand(JNIEnv *env, jobject obj, jobject dumpObj, jstring commandObject); - /** * @brief * @param *env