-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c08adcc
commit 9f92cb2
Showing
9 changed files
with
168 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>PAva-P1</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
Empty file.
Empty file.
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,94 @@ | ||
package ist.meic.pa; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
public class DebuggerCLI { | ||
|
||
public static void main(String[] args) { | ||
|
||
String programToDebug = args[0]; | ||
|
||
try { | ||
|
||
|
||
// TODO: ir buscar class 'a classpool | ||
|
||
// Get class of the program to debug | ||
Class<?> program = Class.forName(programToDebug); | ||
// Get the method 'main' of the program to debug | ||
Method main = program.getMethod("main", String[].class); | ||
|
||
// main_args: arguments of the program to debug | ||
String[] main_args = new String[args.length - 1]; | ||
|
||
// Get the arguments | ||
for(int i = 1; i < args.length; i++){ | ||
main_args[i - 1] = args[i]; | ||
} | ||
|
||
// Invoke the main method with the respective arguments | ||
main.invoke(null, (Object) main_args); | ||
|
||
|
||
} catch (InvocationTargetException ite){ | ||
|
||
System.out.print("DebuggerCLI:> "); | ||
String input = System.console().readLine(); | ||
System.out.println("Command: " + input); | ||
|
||
String[] split_input = input.split(" "); | ||
String command = split_input[0]; | ||
|
||
// Abort: | ||
// Terminates the execution of the application | ||
if (command.equals("Abort")){ | ||
return; | ||
|
||
// Info: | ||
// Presents detailed information about the called object, its fields, | ||
// and the call stack. The presented information follows the format | ||
// described in the next section. | ||
} else if (command.equals("Info")){ | ||
|
||
// Throw: | ||
// Re-throws the exception, so that it may be handled by the next handler. | ||
} else if (command.equals("Throw")){ | ||
|
||
// Return <value>: | ||
// Ignores the exception and continues the execution of the application | ||
// assuming that the current method call returned <value>. For calls to methods | ||
// returning void the <value> is ignored. Note that <value> should be of a | ||
// primitive type. | ||
} else if (command.equals("Return")) { | ||
|
||
String value = split_input[1]; | ||
|
||
} else if(command.equals("Get")){ | ||
|
||
} else if(command.equals("Set")){ | ||
|
||
} else if(command.equals("Retry")){ | ||
|
||
} else { | ||
System.out.println("Unrecognized command"); | ||
return; | ||
} | ||
|
||
} catch(ArrayIndexOutOfBoundsException aiobe){ | ||
|
||
} catch (ClassNotFoundException e) { | ||
e.printStackTrace(); | ||
} catch (NoSuchMethodException e) { | ||
e.printStackTrace(); | ||
} catch (SecurityException e) { | ||
e.printStackTrace(); | ||
} catch (IllegalAccessException e) { | ||
e.printStackTrace(); | ||
} catch (IllegalArgumentException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
} |
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,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* @author ASUS | ||
* | ||
*/ | ||
package ist.meic.pa; |
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,24 @@ | ||
package ist.meic.pa.test; | ||
|
||
public class Test01 { | ||
|
||
public static void a() throws ArrayIndexOutOfBoundsException{ b(); } | ||
|
||
public static void b() throws ArrayIndexOutOfBoundsException { c(); } | ||
|
||
public static void c() { throw new ArrayIndexOutOfBoundsException(); } | ||
|
||
public static void main(String[] args){ | ||
|
||
// Print arguments | ||
for(int i = 0; i < args.length; i++){ | ||
|
||
System.out.println("Argument " + i + ": " + args[i]); | ||
|
||
} | ||
|
||
a(); | ||
|
||
} | ||
|
||
} |
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,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* @author ASUS | ||
* | ||
*/ | ||
package ist.meic.pa.test; |