Skip to content

Commit 71dd731

Browse files
committed
Remove support for jextract -interactive
This commit will remove support for '-interactive' flag from jextract executable. 1. Removed the method responsible for dealing with '-interactive' flag 2. Removed unused imports required by said method 3. Removed unused exports of said method in other files 4. Removed the following files which are now unused: runtime/jextractnatives/jextractnatives_internal.h runtime/jextractnatives/jextractglue.c 5. Reordered imports and removed empty lines
1 parent 5570f22 commit 71dd731

File tree

8 files changed

+4
-213
lines changed

8 files changed

+4
-213
lines changed

debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/JextractCommand.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,19 @@
2828
import com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException;
2929
import com.ibm.j9ddr.tools.ddrinteractive.Command;
3030

31-
public class JextractCommand extends Command
31+
public class JextractCommand extends Command
3232
{
3333
public JextractCommand()
3434
{
3535
addCommand("jextract", "<filename>", "dump a JExtract file to filename (or console)");
3636
}
3737

38-
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException
38+
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException
3939
{
4040
try {
4141
throw new CorruptDataException("command not implemented");
4242
} catch (CorruptDataException e) {
4343
throw new DDRInteractiveCommandException(e);
4444
}
4545
}
46-
4746
}

jcl/src/openj9.dtfj/share/classes/com/ibm/jvm/j9/dump/extract/Main.java

+2-52
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@
2222
*******************************************************************************/
2323
package com.ibm.jvm.j9.dump.extract;
2424

25-
import java.io.BufferedReader;
2625
import java.io.File;
2726
import java.io.FileNotFoundException;
2827
import java.io.FileOutputStream;
2928
import java.io.IOException;
3029
import java.io.InputStream;
31-
import java.io.InputStreamReader;
3230
import java.io.OutputStream;
3331
import java.io.OutputStreamWriter;
3432
import java.io.PrintWriter;
@@ -276,10 +274,8 @@ public static void main(String[] args) {
276274
String outputName = null;
277275
File virtualRootDirectory = null;
278276
boolean ignoreOptions = false;
279-
boolean interactive = false;
280277
boolean verbose = false;
281278
boolean throwExceptions = false;
282-
boolean zip = true;
283279
boolean disableBuildIdCheck = false;
284280
boolean excludeCoreFile = false;
285281

@@ -291,8 +287,6 @@ public static void main(String[] args) {
291287
if (!ignoreOptions && args[i].startsWith("-")) { //$NON-NLS-1$
292288
if ("--".equals(args[i])) { //$NON-NLS-1$
293289
ignoreOptions = true;
294-
} else if ("-interactive".equals(args[i])) { //$NON-NLS-1$
295-
interactive = true;
296290
} else if ("-help".equals(args[i])) { //$NON-NLS-1$
297291
usageMessage(null, JEXTRACT_SUCCESS);
298292
} else if ("-f".equals(args[i])) { //$NON-NLS-1$
@@ -338,14 +332,8 @@ public static void main(String[] args) {
338332

339333
Main dumper = new Main(dumpName, virtualRootDirectory, verbose, throwExceptions, disableBuildIdCheck, excludeCoreFile);
340334

341-
if (interactive) {
342-
dumper.runInteractive();
343-
} else {
344-
if (zip) {
345-
dumper.runZip(outputName);
346-
}
347-
report("jextract complete."); //$NON-NLS-1$
348-
}
335+
dumper.runZip(outputName);
336+
report("jextract complete."); //$NON-NLS-1$
349337

350338
if (dumper._dump != null) {
351339
try {
@@ -512,41 +500,6 @@ private void runZip(String outputName) {
512500
}
513501
}
514502

515-
private void runInteractive() {
516-
report("Jextract interactive mode."); //$NON-NLS-1$
517-
report("Type '!j9help' for help."); //$NON-NLS-1$
518-
report("Type 'quit' to quit."); //$NON-NLS-1$
519-
report("(Commands must be prefixed with '!')"); //$NON-NLS-1$
520-
521-
IAbstractAddressSpace addressSpace = _dump.getAddressSpace();
522-
523-
if (addressSpace == null) {
524-
report("Error. Address space not found in dump: " + _dumpName //$NON-NLS-1$
525-
+ ". Dump is truncated, corrupted or does not contain a supported JVM."); //$NON-NLS-1$
526-
return;
527-
}
528-
529-
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
530-
531-
try {
532-
while (true) {
533-
report("> "); //$NON-NLS-1$
534-
String command = input.readLine().trim();
535-
if ("quit".equalsIgnoreCase(command) || "q".equalsIgnoreCase(command)) { //$NON-NLS-1$ //$NON-NLS-2$
536-
break;
537-
}
538-
try {
539-
doCommand(addressSpace, command);
540-
} catch (Throwable e) {
541-
report(e.getMessage());
542-
report("Failure detected during command execution, see previous message(s)."); //$NON-NLS-1$
543-
}
544-
}
545-
} catch (IOException e) {
546-
report("Error reading input."); //$NON-NLS-1$
547-
}
548-
}
549-
550503
private static void report(String message) {
551504
System.err.println(message);
552505
}
@@ -677,7 +630,4 @@ private static void copy(ClosingFileReader from, OutputStream to, byte[] buffer)
677630
}
678631

679632
private native long getEnvironmentPointer(IAbstractAddressSpace dump, boolean disableBuildIdCheck) throws Exception;
680-
681-
private native void doCommand(IAbstractAddressSpace dump, String command) throws Exception;
682-
683633
}

runtime/jextractnatives/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,19 @@
2323
set(OMR_ENHANCED_WARNINGS OFF)
2424

2525
j9vm_add_library(j9jextract SHARED
26-
jextractglue.c
2726
jextractnatives.c
28-
2927
)
3028

3129
target_link_libraries(j9jextract
3230
PRIVATE
3331
j9vm_interface
34-
3532
j9dbgext
3633
j9util
3734
j9utilcore
3835
j9pool
3936
)
4037

4138
omr_add_exports(j9jextract
42-
Java_com_ibm_jvm_j9_dump_extract_Main_doCommand
4339
Java_com_ibm_jvm_j9_dump_extract_Main_getEnvironmentPointer
4440
)
4541

runtime/jextractnatives/jextractglue.c

-69
This file was deleted.

runtime/jextractnatives/jextractnatives.c

-25
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "j9dbgext.h"
2626
#include "j9protos.h"
2727
#include "j9port.h"
28-
#include "jextractnatives_internal.h"
2928
#include "j9version.h"
3029

3130
#include <stdarg.h>
@@ -289,30 +288,6 @@ cacheIDs(JNIEnv* env, jobject dumpObj)
289288
return 0;
290289
}
291290

292-
void JNICALL
293-
Java_com_ibm_jvm_j9_dump_extract_Main_doCommand(JNIEnv *env, jobject obj, jobject dumpObj, jstring commandObject)
294-
{
295-
const char *command = (*env)->GetStringUTFChars(env, commandObject, 0);
296-
PORT_ACCESS_FROM_VMC((J9VMThread*)env);
297-
298-
if (command == NULL) {
299-
return;
300-
}
301-
302-
if (cacheIDs(env, dumpObj)) {
303-
return;
304-
}
305-
306-
/* hook the debug extension's malloc and free up to ours, so that it can benefit from -memorycheck */
307-
OMRPORT_FROM_J9PORT(dbgGetPortLibrary())->mem_allocate_memory = OMRPORT_FROM_J9PORT(PORTLIB)->mem_allocate_memory;
308-
OMRPORT_FROM_J9PORT(dbgGetPortLibrary())->mem_free_memory = OMRPORT_FROM_J9PORT(PORTLIB)->mem_free_memory;
309-
OMRPORT_FROM_J9PORT(dbgGetPortLibrary())->port_control = OMRPORT_FROM_J9PORT(PORTLIB)->port_control;
310-
311-
run_command(command);
312-
313-
(*env)->ReleaseStringUTFChars(env, commandObject, command);
314-
}
315-
316291
/**
317292
* Gets the environment pointer from the J9RAS structure.
318293
*/

runtime/jextractnatives/jextractnatives_internal.h

-48
This file was deleted.

runtime/jextractnatives/module.xml

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
2323
<module>
2424

2525
<exports group="all">
26-
<export name="Java_com_ibm_jvm_j9_dump_extract_Main_doCommand"/>
2726
<export name="Java_com_ibm_jvm_j9_dump_extract_Main_getEnvironmentPointer"/>
2827
</exports>
2928

runtime/oti/jextractnatives_api.h

-11
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,6 @@ extern "C" {
4444

4545
/* ---------------- jextractnatives.c ---------------- */
4646

47-
/**
48-
* @brief
49-
* @param *env
50-
* @param obj
51-
* @param dumpObj
52-
* @param commandObject
53-
* @return void
54-
*/
55-
void JNICALL
56-
Java_com_ibm_jvm_j9_dump_extract_Main_doCommand(JNIEnv *env, jobject obj, jobject dumpObj, jstring commandObject);
57-
5847
/**
5948
* @brief
6049
* @param *env

0 commit comments

Comments
 (0)