mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-22 01:17:03 +00:00
Fixed twolevel nested debugging
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
private static var s:Socket;
|
||||
private static var q = [];
|
||||
private static var first:Boolean = true;
|
||||
private static var inited:Boolean = false;
|
||||
private static var name:String;
|
||||
private static var failed:Boolean = false;
|
||||
@@ -34,12 +33,16 @@
|
||||
public static const MSG_DUMP_BYTEARRAY = 3;
|
||||
public static const MSG_REQUEST_BYTEARRAY = 4;
|
||||
public static const MSG_LOADER_URL_INFO = 5;
|
||||
public static const MSG_LOADER_MODIFY_BYTES = 6;
|
||||
public static const MSG_LOADER_MODIFY_BYTES = 6;
|
||||
|
||||
private static var connected:Boolean = false;
|
||||
|
||||
public static const SHOW_TRACE = false;
|
||||
|
||||
private static function sendQueue(){
|
||||
if (SHOW_TRACE) trace("debugswf: client " + name + " sending queue");
|
||||
var qo = q;
|
||||
q = [];
|
||||
sendHeader();
|
||||
for each(var m in qo){
|
||||
writeMsg(m.data,m.type);
|
||||
}
|
||||
@@ -103,25 +106,30 @@
|
||||
if(inited){
|
||||
return;
|
||||
}
|
||||
if (SHOW_TRACE) trace("debugswf: initing client " + sname);
|
||||
name = sname;
|
||||
inited = true;
|
||||
try {
|
||||
s = new Socket();
|
||||
s = new Socket();
|
||||
s.addEventListener(Event.CONNECT, onSocketConnect);
|
||||
s.addEventListener(ProgressEvent.SOCKET_DATA, onSocketData);
|
||||
var port:int = 0;
|
||||
port = 123456;
|
||||
port = 123456;
|
||||
if (SHOW_TRACE) trace("debugswf: connecting client " + sname + " to localhost:" + port) ;
|
||||
s.connect("localhost",port);
|
||||
|
||||
inited = true;
|
||||
} catch (e:SecurityError) {
|
||||
trace("Debugger helper failed to connect to localhost");
|
||||
if (SHOW_TRACE) trace("Debugger helper failed to connect to localhost");
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onSocketConnect(event:Event):void {
|
||||
sendQueue();
|
||||
if (SHOW_TRACE) trace("debugswf: client " + name + " connected");
|
||||
sendHeader();
|
||||
connected = true;
|
||||
sendQueue();
|
||||
}
|
||||
|
||||
|
||||
@@ -150,8 +158,10 @@
|
||||
} else {
|
||||
ba.position = pos;
|
||||
}
|
||||
if (SHOW_TRACE) trace("debugswf: client " + name + " received bytearray of " + ba.length + " bytes");
|
||||
var onComplete = fillByteArraysEvents.pop();
|
||||
if (onComplete != null) {
|
||||
if (SHOW_TRACE) trace("debugswf: client " + name + " calling onComplete");
|
||||
onComplete.call(onComplete);
|
||||
}
|
||||
}
|
||||
@@ -200,15 +210,11 @@
|
||||
}
|
||||
|
||||
private static function sendHeader() {
|
||||
if (!first) {
|
||||
return;
|
||||
}
|
||||
if (!s.connected) {
|
||||
return;
|
||||
}
|
||||
writeStringNull("debug.version.major="+DEBUG_VERSION_MAJOR+";debug.version.minor="+DEBUG_VERSION_MINOR);
|
||||
writeString(name);
|
||||
first = false;
|
||||
}
|
||||
|
||||
public static function writeMsg(msg,msgType=0){
|
||||
@@ -216,7 +222,9 @@
|
||||
return;
|
||||
}
|
||||
if(!inited) {
|
||||
initClient("");
|
||||
var max:int = 100000;
|
||||
var randomInt:int = Math.floor(Math.random() * (max + 1));
|
||||
initClient("rand" + randomInt);
|
||||
}
|
||||
if ((msg is ByteArray) && msgType == MSG_DUMP_BYTEARRAY) {
|
||||
var ba2:ByteArray = new ByteArray();
|
||||
@@ -224,9 +232,9 @@
|
||||
msg = ba2;
|
||||
}
|
||||
|
||||
if(s.connected){
|
||||
sendHeader();
|
||||
s.writeByte(msgType);
|
||||
if(connected) {
|
||||
if (SHOW_TRACE) trace("debugswf: client " + name +" sending msg " + msgType);
|
||||
s.writeByte(msgType);
|
||||
switch(msgType){
|
||||
case MSG_STRING:
|
||||
writeString(msg);
|
||||
@@ -242,6 +250,7 @@
|
||||
break;
|
||||
case MSG_REQUEST_BYTEARRAY:
|
||||
fillByteArrays.push(msg);
|
||||
fillByteArraysEvents.push(null);
|
||||
break;
|
||||
case MSG_LOADER_MODIFY_BYTES:
|
||||
writeString(msg["url"]);
|
||||
@@ -251,7 +260,9 @@
|
||||
break;
|
||||
}
|
||||
s.flush();
|
||||
if (SHOW_TRACE) trace("debugswf: client " + name +" msg " + msgType + " sent");
|
||||
}else{
|
||||
if (SHOW_TRACE) trace("debugswf: client " + name +" pushing msg " + msgType + " to queue");
|
||||
q.push({type:msgType,data:msg});
|
||||
}
|
||||
}
|
||||
|
||||
BIN
libsrc/ffdec_lib/testdata/debug_inner/inner.swf
vendored
BIN
libsrc/ffdec_lib/testdata/debug_inner/inner.swf
vendored
Binary file not shown.
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'04.08.2024'</value>
|
||||
<value>'05.08.2024'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
@@ -32,12 +32,12 @@
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner\src</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner\src\InnerMain.as</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner\src\InnerMain.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'04.08.2024'</value>
|
||||
<value>'05.08.2024'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
@@ -32,12 +32,12 @@
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner\src</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner\src\InnerMain.as</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner\src\InnerMain.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
|
||||
@@ -2,6 +2,8 @@ package
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
|
||||
public class InnerMain extends Sprite
|
||||
{
|
||||
@@ -13,10 +15,24 @@ package
|
||||
else addEventListener(Event.ADDED_TO_STAGE, init);
|
||||
}
|
||||
|
||||
private function init(e:Event = null):void
|
||||
private function init(e:Event = null):void
|
||||
{
|
||||
removeEventListener(Event.ADDED_TO_STAGE, init);
|
||||
// entry point
|
||||
|
||||
var textField:TextField = new TextField();
|
||||
|
||||
textField.text = "Main inner1.";
|
||||
|
||||
var textFormat:TextFormat = new TextFormat();
|
||||
textFormat.size = 24;
|
||||
textFormat.color = 0x000000;
|
||||
textField.setTextFormat(textFormat);
|
||||
textField.width = 200;
|
||||
|
||||
addChild(textField);
|
||||
|
||||
textField.x = 50;
|
||||
textField.y = 125;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,14 +43,17 @@ package
|
||||
var byteArray:ByteArray = new binaryData2Class() as ByteArray;
|
||||
var loader:Loader = new Loader();
|
||||
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
|
||||
//trace("loading innerSwf 2");
|
||||
loader.loadBytes(byteArray);
|
||||
}
|
||||
|
||||
private function onLoaderComplete(event:Event):void {
|
||||
var loaderInfo:LoaderInfo = event.target as LoaderInfo;
|
||||
var className:String = "MyInnerClass2";
|
||||
//trace("getting definition of " + className);
|
||||
var LoadedClass:Class = loaderInfo.applicationDomain.getDefinition(className) as Class;
|
||||
var instance:* = new LoadedClass();
|
||||
//trace("calling innerSwf 2 instance");
|
||||
instance.run(root);
|
||||
}
|
||||
|
||||
|
||||
BIN
libsrc/ffdec_lib/testdata/debug_inner/inner2.swf
vendored
BIN
libsrc/ffdec_lib/testdata/debug_inner/inner2.swf
vendored
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
<output>
|
||||
<movie outputType="Application" />
|
||||
<movie input="" />
|
||||
<movie path="../inner2.swf" />
|
||||
<movie path="..\inner2.swf" />
|
||||
<movie fps="30" />
|
||||
<movie width="800" />
|
||||
<movie height="600" />
|
||||
@@ -72,7 +72,7 @@
|
||||
</library>
|
||||
<!-- Class files to compile (other referenced classes will automatically be included) -->
|
||||
<compileTargets>
|
||||
<compile path="src\Main.as" />
|
||||
<compile path="src\InnerMain2.as" />
|
||||
</compileTargets>
|
||||
<!-- Paths to exclude from the Project Explorer tree -->
|
||||
<hiddenPaths>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'04.08.2024'</value>
|
||||
<value>'05.08.2024'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
@@ -32,12 +32,12 @@
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner2\src</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner2\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner2\src\Main.as</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner2\src\InnerMain2.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'04.08.2024'</value>
|
||||
<value>'05.08.2024'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
@@ -32,12 +32,12 @@
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner2\src</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner2\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\inner2\src\Main.as</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\inner2\src\InnerMain2.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
|
||||
40
libsrc/ffdec_lib/testdata/debug_inner/inner2/src/InnerMain2.as
vendored
Normal file
40
libsrc/ffdec_lib/testdata/debug_inner/inner2/src/InnerMain2.as
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
package
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
|
||||
public class InnerMain2 extends Sprite
|
||||
{
|
||||
MyInnerClass2;
|
||||
|
||||
public function InnerMain2()
|
||||
{
|
||||
if (stage) init();
|
||||
else addEventListener(Event.ADDED_TO_STAGE, init);
|
||||
}
|
||||
|
||||
private function init(e:Event = null):void
|
||||
{
|
||||
removeEventListener(Event.ADDED_TO_STAGE, init);
|
||||
|
||||
var textField:TextField = new TextField();
|
||||
|
||||
textField.text = "Main inner2.";
|
||||
|
||||
var textFormat:TextFormat = new TextFormat();
|
||||
textFormat.size = 24;
|
||||
textFormat.color = 0x000000;
|
||||
textField.setTextFormat(textFormat);
|
||||
textField.width = 200;
|
||||
|
||||
addChild(textField);
|
||||
|
||||
textField.x = 50;
|
||||
textField.y = 100;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class Main extends Sprite
|
||||
{
|
||||
MyInnerClass2;
|
||||
|
||||
public function Main()
|
||||
{
|
||||
if (stage) init();
|
||||
else addEventListener(Event.ADDED_TO_STAGE, init);
|
||||
}
|
||||
|
||||
private function init(e:Event = null):void
|
||||
{
|
||||
removeEventListener(Event.ADDED_TO_STAGE, init);
|
||||
// entry point
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
BIN
libsrc/ffdec_lib/testdata/debug_inner/outer.swf
vendored
BIN
libsrc/ffdec_lib/testdata/debug_inner/outer.swf
vendored
Binary file not shown.
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'04.08.2024'</value>
|
||||
<value>'05.08.2024'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
@@ -32,12 +32,12 @@
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\outer\src</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\outer\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\outer\src\Main.as</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\outer\src\Main.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'04.08.2024'</value>
|
||||
<value>'05.08.2024'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
@@ -32,12 +32,12 @@
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\outer\src</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\outer\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\FlashRelated\test_debugger\inner_debug\outer\src\Main.as</path-element>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\debug_inner\outer\src\Main.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
|
||||
@@ -28,14 +28,17 @@ package
|
||||
var byteArray:ByteArray = new binaryDataClass() as ByteArray;
|
||||
var loader:Loader = new Loader();
|
||||
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
|
||||
//trace("loading innerSwf 1");
|
||||
loader.loadBytes(byteArray);
|
||||
}
|
||||
|
||||
private function onLoaderComplete(event:Event):void {
|
||||
var loaderInfo:LoaderInfo = event.target as LoaderInfo;
|
||||
var className:String = "MyInnerClass";
|
||||
//trace("getting definition of " + className);
|
||||
var LoadedClass:Class = loaderInfo.applicationDomain.getDefinition(className) as Class;
|
||||
var instance:* = new LoadedClass();
|
||||
//trace("calling innerSwf 1 instance");
|
||||
instance.run(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
|
||||
private DebuggerCommands commands = null;
|
||||
|
||||
private List<InSwfInfo.SwfInfo> swfs = new ArrayList<>();
|
||||
//private List<InSwfInfo.SwfInfo> swfs = new ArrayList<>();
|
||||
|
||||
private boolean paused = true;
|
||||
|
||||
@@ -396,6 +396,32 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
invalidBreakPointMap.get(swf).get(scriptName).add(line);
|
||||
}
|
||||
|
||||
private synchronized void markBreakPointConfirmed(SWF swf, String scriptName, int line) {
|
||||
if (!confirmedPointMap.containsKey(swf)) {
|
||||
confirmedPointMap.put(swf, new HashMap<>());
|
||||
}
|
||||
if (!confirmedPointMap.get(swf).containsKey(scriptName)) {
|
||||
confirmedPointMap.get(swf).put(scriptName, new TreeSet<>());
|
||||
}
|
||||
confirmedPointMap.get(swf).get(scriptName).add(line);
|
||||
}
|
||||
|
||||
private synchronized void markBreakPointValid(SWF swf, String scriptName, int line) {
|
||||
if (!invalidBreakPointMap.containsKey(swf)) {
|
||||
return;
|
||||
}
|
||||
if (!invalidBreakPointMap.get(swf).containsKey(scriptName)) {
|
||||
return;
|
||||
}
|
||||
invalidBreakPointMap.get(swf).get(scriptName).remove(line);
|
||||
if (invalidBreakPointMap.get(swf).get(scriptName).isEmpty()) {
|
||||
invalidBreakPointMap.get(swf).remove(scriptName);
|
||||
}
|
||||
if (invalidBreakPointMap.get(swf).isEmpty()) {
|
||||
invalidBreakPointMap.remove(swf);
|
||||
}
|
||||
}
|
||||
|
||||
private InFrame frame;
|
||||
|
||||
@@ -562,10 +588,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
}
|
||||
|
||||
public List<InSwfInfo.SwfInfo> getSwfs() {
|
||||
return swfs;
|
||||
}
|
||||
|
||||
|
||||
public void disconnect() {
|
||||
frame = null;
|
||||
pool = null;
|
||||
@@ -673,7 +696,6 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
});
|
||||
|
||||
swfs.clear();
|
||||
swfIndicesCommited.clear();
|
||||
swfIndicesNewToSwfHash.clear();
|
||||
|
||||
@@ -759,11 +781,12 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.WARNING, "SWF with hash {0} not found", swfHash);
|
||||
} else {
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "adding {0} to debugSwfs", swfIndex);
|
||||
swfIndicesCommited.add(swfIndex);
|
||||
debuggedSwfs.add(swf);
|
||||
}
|
||||
} else {
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "Swf index already commited");
|
||||
}
|
||||
}
|
||||
}
|
||||
con.dropMessage(sc);
|
||||
}
|
||||
@@ -804,8 +827,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
con.addMessageListener(new DebugMessageListener<InSwfInfo>() {
|
||||
@Override
|
||||
public void message(InSwfInfo t) {
|
||||
for (InSwfInfo.SwfInfo s : t.swfInfos) {
|
||||
swfs.add(s);
|
||||
/*for (InSwfInfo.SwfInfo s : t.swfInfos) {
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -817,7 +839,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
con.dropMessage(t);
|
||||
}
|
||||
});
|
||||
@@ -845,13 +867,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.INFO, "Breakpoint {0}:{1} submitted successfully", new Object[]{sname, isb.lines.get(i)});
|
||||
}
|
||||
}
|
||||
|
||||
con.addMessageListener(new DebugMessageListener<InAskBreakpoints>() {
|
||||
@Override
|
||||
public void message(InAskBreakpoints message) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
con.addMessageListener(new DebugMessageListener<InContinue>() {
|
||||
@Override
|
||||
public void message(InContinue msg) {
|
||||
@@ -864,6 +880,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
con.addMessageListener(new DebugMessageListener<InBreakAt>() {
|
||||
@Override
|
||||
public void message(InBreakAt message) {
|
||||
@@ -897,18 +914,20 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
Logger.getLogger(DebuggerCommands.class.getName()).log(Level.SEVERE, "Invalid file: {0}", message.file);
|
||||
//return;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < debuggedSwfs.size(); i++) {
|
||||
swfIndicesCommited.add(i);
|
||||
}
|
||||
|
||||
|
||||
final String[] reasonNames = new String[]{"unknown", "breakpoint", "watch", "fault", "stopRequest", "step", "halt", "scriptLoaded"};
|
||||
String reason = reasonInt < reasonNames.length ? reasonNames[reasonInt] : reasonNames[0];
|
||||
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "break at {0}:{1}, reason: {2}", new Object[]{newBreakScriptName, message.line, reason});
|
||||
|
||||
sendBreakPoints();
|
||||
|
||||
try {
|
||||
sendBreakPoints();
|
||||
} catch (IOException ex) {
|
||||
//ignore
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "send breakpoints exception: " + ex.getMessage());
|
||||
}
|
||||
|
||||
synchronized (DebuggerHandler.this) {
|
||||
breakScriptName = newBreakScriptName;
|
||||
breakIp = message.line;
|
||||
@@ -1030,7 +1049,8 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
|
||||
if (toAddBPointMap.containsKey(debuggedSwf)) {
|
||||
for (String scriptName : toAddBPointMap.get(debuggedSwf).keySet()) {
|
||||
Set<String> toAddScripts = new HashSet<>(toAddBPointMap.get(debuggedSwf).keySet());
|
||||
for (String scriptName : toAddScripts) {
|
||||
if (scriptName.startsWith("#PCODE") != Main.isDebugPCode()) {
|
||||
continue;
|
||||
}
|
||||
@@ -1038,16 +1058,19 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
int file = moduleIdOf(hash + ":" + scriptName);
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINEST, "module = {0}", file);
|
||||
if (file > -1) {
|
||||
for (int line : toAddBPointMap.get(debuggedSwf).get(scriptName)) {
|
||||
Set<Integer> lines = new HashSet<>(toAddBPointMap.get(debuggedSwf).get(scriptName));
|
||||
for (int line : lines) {
|
||||
if (commands.addBreakPoint(file, line)) {
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.INFO, "Breakpoint {0}:{1} submitted successfully", new Object[]{scriptName, line});
|
||||
if (!confirmedPointMap.containsKey(debuggedSwf)) {
|
||||
confirmedPointMap.put(debuggedSwf, new HashMap<>());
|
||||
markBreakPointConfirmed(debuggedSwf, scriptName, line);
|
||||
markBreakPointValid(debuggedSwf, scriptName, line);
|
||||
toAddBPointMap.get(debuggedSwf).get(scriptName).remove(line);
|
||||
if (toAddBPointMap.get(debuggedSwf).get(scriptName).isEmpty()) {
|
||||
toAddBPointMap.get(debuggedSwf).remove(scriptName);
|
||||
}
|
||||
if (!confirmedPointMap.get(debuggedSwf).containsKey(scriptName)) {
|
||||
confirmedPointMap.get(debuggedSwf).put(scriptName, new TreeSet<>());
|
||||
if (toAddBPointMap.get(debuggedSwf).isEmpty()) {
|
||||
toAddBPointMap.remove(debuggedSwf);
|
||||
}
|
||||
confirmedPointMap.get(debuggedSwf).get(scriptName).add(line);
|
||||
} else {
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.INFO, "Breakpoint {0}:{1} unable to submit", new Object[]{scriptName, line});
|
||||
markBreakPointInvalid(debuggedSwf, scriptName, line);
|
||||
@@ -1058,13 +1081,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
markBreakPointInvalid(debuggedSwf, scriptName, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINEST, "clearing toAddBps of {0}", hash);
|
||||
toAddBPointMap.get(debuggedSwf).clear();
|
||||
|
||||
if (toAddBPointMap.get(debuggedSwf).isEmpty()) {
|
||||
toAddBPointMap.remove(debuggedSwf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,9 +476,9 @@ public class Main {
|
||||
try {
|
||||
File fTempFile = new File(instrSWF.getFile());
|
||||
instrSWF.enableDebugging(true, new File("."), true, doPCode, swfHash);
|
||||
FileOutputStream fos = new FileOutputStream(fTempFile);
|
||||
instrSWF.saveTo(fos);
|
||||
fos.close();
|
||||
try (FileOutputStream fos = new FileOutputStream(fTempFile)) {
|
||||
instrSWF.saveTo(fos);
|
||||
}
|
||||
if (!instrSWF.isAS3()) {
|
||||
//Read again, because line file offsets changed with adding debug tags
|
||||
//TODO: handle somehow without rereading?
|
||||
@@ -550,7 +550,7 @@ public class Main {
|
||||
String url = it.getUrl();
|
||||
File importedFile = new File(origFile.getParentFile(), url);
|
||||
if (importedFile.exists()) {
|
||||
File newTempFile = createTempFileInDir(tempFilesDir, "~ffdec_run_import_", ".swf");
|
||||
File newTempFile = createTempFileInDir(tempFilesDir, "~ffdec_run_import_", ".swf");
|
||||
it.setUrl("./" + newTempFile.getName());
|
||||
byte[] impData = Helper.readFile(importedFile.getAbsolutePath());
|
||||
Helper.writeFile(newTempFile.getAbsolutePath(), impData);
|
||||
@@ -2503,15 +2503,18 @@ public class Main {
|
||||
try(FileOutputStream fos = new FileOutputStream(tempFile)) {
|
||||
fos.write(inputData);
|
||||
}
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "preparing for load: {0}", hash);
|
||||
prepareSwf("loaded_" + hash, runningPreparation, tempFile, mainSWF.getFile() == null ? null : new File(mainSWF.getFile()), tempRunDir, runTempFiles);
|
||||
byte outputData[] = Helper.readFileEx(tempFile.getAbsolutePath());
|
||||
tempFile.delete();
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "calling datamodified");
|
||||
modifiedListener.dataModified(outputData);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "finished opened method");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -350,18 +350,22 @@ public class Debugger {
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.FINER, "IOException in injected debugger thread: {0}", ex.getMessage());
|
||||
//ignore
|
||||
}
|
||||
try {
|
||||
s.close();
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.FINER, "Socked close exception in injected debugger thread: {0}", ex.getMessage());
|
||||
//ignore
|
||||
}
|
||||
finished = true;
|
||||
active = false;
|
||||
logger.log(Level.FINER, "Calling onFinish");
|
||||
for (DebugListener l : listeners) {
|
||||
l.onFinish(clientName);
|
||||
}
|
||||
logger.log(Level.FINER, "Injected debugger finished");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user