-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(debugger): resolve IO read problems, proper socket closing (PR #1414
) * fix(debugger): several IO read problems fixed * merged latest changes * fixed read loop * Update jadx-gui/src/main/java/jadx/gui/device/protocol/ADB.java Co-authored-by: skylot <118523+skylot@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
719 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
jadx-gui/src/main/java/jadx/gui/device/debugger/EventListenerAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package jadx.gui.device.debugger; | ||
|
||
import io.github.hqktech.JDWP.Event.Composite.BreakpointEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.ClassPrepareEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.ClassUnloadEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.ExceptionEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.FieldAccessEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.FieldModificationEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.MethodEntryEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.MethodExitEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.MethodExitWithReturnValueEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.MonitorContendedEnterEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.MonitorContendedEnteredEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.MonitorWaitEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.MonitorWaitedEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.SingleStepEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.ThreadDeathEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.ThreadStartEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.VMDeathEvent; | ||
import io.github.hqktech.JDWP.Event.Composite.VMStartEvent; | ||
|
||
abstract class EventListenerAdapter { | ||
void onVMStart(VMStartEvent event) { | ||
} | ||
|
||
void onVMDeath(VMDeathEvent event) { | ||
} | ||
|
||
void onSingleStep(SingleStepEvent event) { | ||
} | ||
|
||
void onBreakpoint(BreakpointEvent event) { | ||
} | ||
|
||
void onMethodEntry(MethodEntryEvent event) { | ||
} | ||
|
||
void onMethodExit(MethodExitEvent event) { | ||
} | ||
|
||
void onMethodExitWithReturnValue(MethodExitWithReturnValueEvent event) { | ||
} | ||
|
||
void onMonitorContendedEnter(MonitorContendedEnterEvent event) { | ||
} | ||
|
||
void onMonitorContendedEntered(MonitorContendedEnteredEvent event) { | ||
} | ||
|
||
void onMonitorWait(MonitorWaitEvent event) { | ||
} | ||
|
||
void onMonitorWaited(MonitorWaitedEvent event) { | ||
} | ||
|
||
void onException(ExceptionEvent event) { | ||
} | ||
|
||
void onThreadStart(ThreadStartEvent event) { | ||
} | ||
|
||
void onThreadDeath(ThreadDeathEvent event) { | ||
} | ||
|
||
void onClassPrepare(ClassPrepareEvent event) { | ||
} | ||
|
||
void onClassUnload(ClassUnloadEvent event) { | ||
} | ||
|
||
void onFieldAccess(FieldAccessEvent event) { | ||
} | ||
|
||
void onFieldModification(FieldModificationEvent event) { | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
jadx-gui/src/main/java/jadx/gui/device/debugger/RuntimeType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package jadx.gui.device.debugger; | ||
|
||
import io.github.hqktech.JDWP; | ||
|
||
public enum RuntimeType { | ||
ARRAY(91, "[]"), | ||
BYTE(66, "byte"), | ||
CHAR(67, "char"), | ||
OBJECT(76, "object"), | ||
FLOAT(70, "float"), | ||
DOUBLE(68, "double"), | ||
INT(73, "int"), | ||
LONG(74, "long"), | ||
SHORT(83, "short"), | ||
VOID(86, "void"), | ||
BOOLEAN(90, "boolean"), | ||
STRING(115, "string"), | ||
THREAD(116, "thread"), | ||
THREAD_GROUP(103, "thread_group"), | ||
CLASS_LOADER(108, "class_loader"), | ||
CLASS_OBJECT(99, "class_object"); | ||
|
||
private final int jdwpTag; | ||
private final String desc; | ||
|
||
RuntimeType(int tag, String desc) { | ||
this.jdwpTag = tag; | ||
this.desc = desc; | ||
} | ||
|
||
public int getTag() { | ||
return jdwpTag; | ||
} | ||
|
||
public String getDesc() { | ||
return this.desc; | ||
} | ||
|
||
/** | ||
* Converts a <code>JDWP.Tag</code> to a {@link RuntimeType} | ||
* | ||
* @param tag | ||
* @return | ||
* @throws SmaliDebuggerException | ||
*/ | ||
public static RuntimeType fromJdwpTag(int tag) throws SmaliDebuggerException { | ||
switch (tag) { | ||
case JDWP.Tag.ARRAY: | ||
return RuntimeType.ARRAY; | ||
case JDWP.Tag.BYTE: | ||
return RuntimeType.BYTE; | ||
case JDWP.Tag.CHAR: | ||
return RuntimeType.CHAR; | ||
case JDWP.Tag.OBJECT: | ||
return RuntimeType.OBJECT; | ||
case JDWP.Tag.FLOAT: | ||
return RuntimeType.FLOAT; | ||
case JDWP.Tag.DOUBLE: | ||
return RuntimeType.DOUBLE; | ||
case JDWP.Tag.INT: | ||
return RuntimeType.INT; | ||
case JDWP.Tag.LONG: | ||
return RuntimeType.LONG; | ||
case JDWP.Tag.SHORT: | ||
return RuntimeType.SHORT; | ||
case JDWP.Tag.VOID: | ||
return RuntimeType.VOID; | ||
case JDWP.Tag.BOOLEAN: | ||
return RuntimeType.BOOLEAN; | ||
case JDWP.Tag.STRING: | ||
return RuntimeType.STRING; | ||
case JDWP.Tag.THREAD: | ||
return RuntimeType.THREAD; | ||
case JDWP.Tag.THREAD_GROUP: | ||
return RuntimeType.THREAD_GROUP; | ||
case JDWP.Tag.CLASS_LOADER: | ||
return RuntimeType.CLASS_LOADER; | ||
case JDWP.Tag.CLASS_OBJECT: | ||
return RuntimeType.CLASS_OBJECT; | ||
default: | ||
throw new SmaliDebuggerException("Unexpected value: " + tag); | ||
} | ||
} | ||
} |
Oops, something went wrong.