Merge remote-tracking branch 'origin/master' into BETA_JAVA9
diff --git a/org.eclipse.jdt.debug.tests/testprograms/StepResult1.java b/org.eclipse.jdt.debug.tests/testprograms/StepResult1.java
new file mode 100644
index 0000000..c7cffe3
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/testprograms/StepResult1.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Till Brychcy and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Till Brychcy - initial API and implementation
+ *******************************************************************************/
+
+public class StepResult1 {
+ class Nested {
+ String f() {
+ return "f-" + g();
+ }
+ }
+
+ // private to force usage of a synthetic accessor
+ private String g() {
+ String prefix = "g-";
+ String val1 = prefix + h();
+ String val2 = j(false);
+ return val1 + "-" + val2; // bp2C
+ }
+
+ String h() {
+ String prefix = "h-"; // bp1
+ try {
+ return i(false);
+ } catch (Exception e) {
+ // when the thread is stopped here, it is exactly 5 bytes after the i(false) invocation in the byte code
+ return prefix + e.getMessage();
+ }
+ }
+
+ String i(boolean flag) {
+ if (flag) {
+ return "i";
+ }
+ String value = i(true); // bp3
+ throw new RuntimeException(value);
+ }
+
+ String j(boolean flag) {
+ if (flag) {
+ return "j";
+ }
+ String value = j(true); // bp2A
+ return value; // bp2B
+ }
+
+ static String x = "x";
+
+ public static String s() {
+ return "bla"; // bp4
+ }
+
+ interface I {
+ String get();
+ }
+
+ public void testViaInterface() {
+ I i = new I() {
+ public String get() {
+ return "bla"; // bp5
+ };
+ };
+ i.get();
+ }
+ public static void main(String[] args) {
+ new StepResult1().new Nested().f();
+ s();
+ "".length();
+ new StepResult1().testViaInterface();;
+ }
+}
diff --git a/org.eclipse.jdt.debug.tests/testprograms/StepResult2.java b/org.eclipse.jdt.debug.tests/testprograms/StepResult2.java
new file mode 100644
index 0000000..42ea8be
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/testprograms/StepResult2.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Till Brychcy and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Till Brychcy - initial API and implementation
+ *******************************************************************************/
+
+public class StepResult2 {
+ public static void main(String[] args) {
+ f();
+ }
+
+ private static void f() {
+ try {
+ g();
+ } catch (Exception e) {
+ // empty
+ }
+ }
+
+ private static void g() {
+ try {
+ h();
+ } finally {
+ "".length();
+ }
+ }
+
+ private static void h() {
+ i();
+ }
+
+ private static void i() {
+ throw new RuntimeException("hi"); // bp6
+ }
+}
diff --git a/org.eclipse.jdt.debug.tests/testprograms/StepResult3.java b/org.eclipse.jdt.debug.tests/testprograms/StepResult3.java
new file mode 100644
index 0000000..9b31bf5
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/testprograms/StepResult3.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Till Brychcy and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Till Brychcy - initial API and implementation
+ *******************************************************************************/
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+
+public class StepResult3 {
+ interface StringSupplier {
+ String get();
+ }
+ static String f() throws Exception {
+ System.class.hashCode(); // bp7
+ StringSupplier p = (StringSupplier) Proxy.newProxyInstance(StepResult3.class.getClassLoader(),
+ new Class[] { StringSupplier.class }, new InvocationHandler() {
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ return "hello from proxy";
+ }
+ });
+ p.get();
+ h();
+ g(0); // bp8
+ String x = g(1);
+ return x;
+ }
+
+ private static Object h() {
+ return null;
+ }
+
+ private static String g(int a) throws Exception {
+ if (a == 1)
+ throw new Exception("YYY");
+ else {
+ return "XXX";
+ }
+ }
+
+ public static void main(String[] args) {
+ try {
+ f();
+ } catch (Exception e) {
+ System.out.println("e:" + e.getMessage());
+ System.currentTimeMillis();
+ }
+ }
+}
diff --git a/org.eclipse.jdt.debug.tests/testprograms/TriggerPoint_01.java b/org.eclipse.jdt.debug.tests/testprograms/TriggerPoint_01.java
new file mode 100644
index 0000000..1e4a485
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/testprograms/TriggerPoint_01.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+public class TriggerPoint_01 {
+ int i =0, j=0;
+
+ public static void main(String[] args) {
+ TriggerPoint_01 t =new TriggerPoint_01();
+ t.test1();
+ t.test2();
+ t.test1();
+ t.test2();
+ t.test1();
+ }
+
+ public void test1(){
+ i++;
+ System.out.println("Test1");
+ }
+
+ public void test2(){
+ j++;
+ System.out.println("Test2");
+ }
+
+}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/StepResultTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/StepResultTests.java
new file mode 100644
index 0000000..da83866
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/StepResultTests.java
@@ -0,0 +1,473 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Till Brychcy and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Till Brychcy - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.debug.test.stepping;
+
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaDebugTarget;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaStackFrame;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.tests.AbstractDebugTest;
+
+public class StepResultTests extends AbstractDebugTest {
+
+ public StepResultTests(String name) {
+ super(name);
+ }
+
+ public void testReturnValueAfterStepReturn() throws Exception {
+ String typeName = "StepResult1";
+ ILineBreakpoint bp1 = createLineBreakpoint(28, "StepResult1");
+ bp1.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp1, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("h", stackFrame.getMethodName());
+
+ thread = stepReturn(stackFrame);
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g", stackFrame.getMethodName());
+ IVariable varInG = stackFrame.getVariables()[0];
+ assertEquals("h() returned", varInG.getName());
+ assertEquals("\"h-i\"", varInG.getValue().toString());
+
+
+ // skip the synthetic via a step filter.
+ IJavaDebugTarget javaDebugTarget = (IJavaDebugTarget) stackFrame.getDebugTarget();
+ boolean oldStepFiltersEnabled = javaDebugTarget.isStepFiltersEnabled();
+ boolean oldFilterSynthetics = javaDebugTarget.isFilterSynthetics();
+ try {
+ javaDebugTarget.setStepFiltersEnabled(true);
+ javaDebugTarget.setFilterSynthetics(true);
+ thread = stepReturn(stackFrame);
+ }
+ finally {
+ javaDebugTarget.setStepFiltersEnabled(oldStepFiltersEnabled);
+ javaDebugTarget.setFilterSynthetics(oldFilterSynthetics);
+ }
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("f", stackFrame.getMethodName());
+ IVariable varInF = stackFrame.getVariables()[0];
+ assertEquals("access$0() returned", varInF.getName());
+ assertEquals("\"g-h-i-j\"", varInF.getValue().toString());
+
+ thread = stepReturn(stackFrame);
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("main", stackFrame.getMethodName());
+ IVariable varInMain1 = stackFrame.getVariables()[0];
+ assertEquals("f() returned", varInMain1.getName());
+
+ // test that running the thread a bit will clear the "f() returned"
+ thread = stepOver(stackFrame);
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("main", stackFrame.getMethodName());
+ IVariable varInMain2 = stackFrame.getVariables()[0];
+ assertEquals("x", varInMain2.getName());
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ /**
+ * test that if the step return is aborted by some other break point, no return value of a recursive invocation is shown
+ *
+ * @throws Exception
+ */
+ public void testNoReturnValueAfterAbortedStepReturn() throws Exception {
+ String typeName = "StepResult1";
+ ILineBreakpoint bp2A = createLineBreakpoint(49, "StepResult1");
+ bp2A.setEnabled(true);
+ ILineBreakpoint bp2B = createLineBreakpoint(50, "StepResult1");
+ bp2B.setEnabled(true);
+ ILineBreakpoint bp2C = createLineBreakpoint(24, "StepResult1");
+ bp2C.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp2A, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("j", stackFrame.getMethodName());
+
+ // trigger stepReturn, but bp2B will be hit.
+ stackFrame.stepReturn();
+
+ resumeToLineBreakpoint(thread, bp2B);
+
+ IStackFrame[] stackFrames = thread.getStackFrames();
+ stackFrame = (IJavaStackFrame) stackFrames[0];
+ assertEquals("j", stackFrame.getMethodName());
+
+ stackFrame = (IJavaStackFrame) stackFrames[1];
+ assertEquals("g", stackFrame.getMethodName());
+
+ // bp2C is at the target stack level of the stepReturn
+ resumeToLineBreakpoint(thread, bp2C);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g", stackFrame.getMethodName());
+
+ IVariable varInH = stackFrame.getVariables()[0];
+
+ // specifically no "i() returned" must be present
+ assertEquals("this", varInH.getName());
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testNoReturnValueAfterStepReturnWithException() throws Exception {
+ String typeName = "StepResult1";
+ ILineBreakpoint bp3A = createLineBreakpoint(41, "StepResult1");
+ bp3A.setEnabled(true);
+ ILineBreakpoint bp3B = createLineBreakpoint(33, "StepResult1");
+ bp3B.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp3A, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("i", stackFrame.getMethodName());
+
+ stepReturn(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("h", stackFrame.getMethodName());
+
+ IVariable varInH = stackFrame.getVariables()[0];
+
+ assertEquals("i() threw", varInH.getName());
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testReturnValueAfterStepReturnInStatic() throws Exception {
+ String typeName = "StepResult1";
+ ILineBreakpoint bp4 = createLineBreakpoint(56, "StepResult1");
+ bp4.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp4, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("s", stackFrame.getMethodName());
+
+ thread = stepReturn(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("main", stackFrame.getMethodName());
+
+ IVariable varInMain = stackFrame.getVariables()[0];
+
+ assertEquals("s() returned", varInMain.getName());
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testReturnValueAfterStepReturnViaInterface() throws Exception {
+ String typeName = "StepResult1";
+ ILineBreakpoint bp5 = createLineBreakpoint(66, "StepResult1");
+ bp5.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp5, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("get", stackFrame.getMethodName());
+
+ thread = stepReturn(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("testViaInterface", stackFrame.getMethodName());
+
+ IVariable varInMain = stackFrame.getVariables()[0];
+
+ assertEquals("get() returned", varInMain.getName());
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testHasExitedWithExceptionFor5BytesDistance() throws Exception {
+ String typeName = "StepResult1";
+ ILineBreakpoint bp3 = createLineBreakpoint(41, "StepResult1");
+ bp3.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp3, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("i", stackFrame.getMethodName());
+
+ stepReturn(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("h", stackFrame.getMethodName());
+
+ IVariable varInH = stackFrame.getVariables()[0];
+
+ assertEquals("i() threw", varInH.getName());
+
+ // will set the thread to running to get the toString result
+ IJavaValue stringValue = ((IJavaObject) varInH.getValue()).sendMessage("toString", "()Ljava/lang/String;", null, thread, false);
+
+ assertEquals("\"java.lang.RuntimeException: i\"", stringValue.toString());
+
+ // because the thread has run in between, check that after refreshing the stack, the thrown exception is still present
+ IVariable varInH2 = stackFrame.getVariables()[0];
+ assertEquals("i() threw", varInH2.getName());
+
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testStepReturn_ExceptionWithFinallyAndEmptyCatch() throws Exception {
+ String typeName = "StepResult2";
+ ILineBreakpoint bp6 = createLineBreakpoint(38, "StepResult2");
+ bp6.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp6, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("i", stackFrame.getMethodName());
+
+ stepReturn(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame(); // in finally clause
+ assertEquals("g", stackFrame.getMethodName());
+
+ IVariable varInG = stackFrame.getVariables()[0];
+
+ assertEquals("i() threw", varInG.getName());
+
+ stepReturn(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame(); // after empty catch clause
+ assertEquals("f", stackFrame.getMethodName());
+
+ IVariable varInF = stackFrame.getVariables()[0];
+
+ assertEquals("g() threw", varInF.getName());
+
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testStepOver_ExceptionWithFinallyAndEmptyCatch() throws Exception {
+ String typeName = "StepResult2";
+ ILineBreakpoint bp6 = createLineBreakpoint(38, "StepResult2");
+ bp6.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp6, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("i", stackFrame.getMethodName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame(); // in finally clause
+ assertEquals("g", stackFrame.getMethodName());
+
+ IVariable varInG = stackFrame.getVariables()[0];
+
+ assertEquals("i() threw", varInG.getName());
+
+ stepOver(stackFrame);
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame(); // still in finally clause
+ assertEquals("g", stackFrame.getMethodName());
+
+ IVariable varInG2 = stackFrame.getVariables()[0];
+
+ assertEquals("length() returned", varInG2.getName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame(); // after empty catch clause
+ assertEquals("f", stackFrame.getMethodName());
+
+ IVariable varInF = stackFrame.getVariables()[0];
+
+ assertEquals("g() threw", varInF.getName());
+
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testStepOver() throws Exception {
+ String typeName = "StepResult3";
+ ILineBreakpoint bp7 = createLineBreakpoint(22, "StepResult3");
+ bp7.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp7, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("f", stackFrame.getMethodName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("hashCode() returned", stackFrame.getVariables()[0].getName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("getClassLoader() returned", stackFrame.getVariables()[0].getName());
+
+ stepOver(stackFrame);
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("<init>() returned", stackFrame.getVariables()[0].getName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("newProxyInstance() returned", stackFrame.getVariables()[0].getName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("get() returned", stackFrame.getVariables()[0].getName());
+ assertEquals("\"hello from proxy\"", stackFrame.getVariables()[0].getValue().toString());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("h() returned", stackFrame.getVariables()[0].getName());
+ assertEquals("null", String.valueOf(stackFrame.getVariables()[0].getValue()));
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g() returned", stackFrame.getVariables()[0].getName());
+ assertEquals("\"XXX\"", stackFrame.getVariables()[0].getValue().toString());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("main", stackFrame.getMethodName());
+ assertEquals("g() threw", stackFrame.getVariables()[0].getName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("println() returned", stackFrame.getVariables()[0].getName());
+
+ stepOver(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("currentTimeMillis() returned", stackFrame.getVariables()[0].getName());
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+ public void testStepInto() throws Exception {
+ String typeName = "StepResult3";
+ ILineBreakpoint bp8 = createLineBreakpoint(31, "StepResult3");
+ bp8.setEnabled(true);
+
+ IJavaThread thread = null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp8, false);
+ IJavaStackFrame stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("f", stackFrame.getMethodName());
+
+ stepInto(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g", stackFrame.getMethodName());
+ assertFalse(stackFrame.getVariables()[0].getName().contains("returned"));
+
+ stepInto(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g", stackFrame.getMethodName());
+ assertFalse(stackFrame.getVariables()[0].getName().contains("returned"));
+
+ stepInto(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("f", stackFrame.getMethodName());
+ assertEquals("g() returned", stackFrame.getVariables()[0].getName());
+ assertEquals("\"XXX\"", stackFrame.getVariables()[0].getValue().toString());
+
+ stepInto(stackFrame);
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("f", stackFrame.getMethodName());
+ assertFalse(stackFrame.getVariables()[0].getName().contains("returned"));
+
+ stepInto(stackFrame);
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g", stackFrame.getMethodName());
+ assertFalse(stackFrame.getVariables()[0].getName().contains("returned"));
+
+ stepInto(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g", stackFrame.getMethodName());
+ assertFalse(stackFrame.getVariables()[0].getName().contains("returned"));
+
+ stepInto(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("<init>", stackFrame.getMethodName()); // constructor of Exception
+ assertFalse(stackFrame.getVariables()[0].getName().contains("returned"));
+
+ stepReturn(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("g", stackFrame.getMethodName());
+ assertEquals("<init>() returned", stackFrame.getVariables()[0].getName());
+
+ stepInto(stackFrame);
+
+ stackFrame = (IJavaStackFrame) thread.getTopStackFrame();
+ assertEquals("main", stackFrame.getMethodName());
+ assertEquals("g() threw", stackFrame.getVariables()[0].getName());
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+
+}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index 89a84bc..10a55cf 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -196,7 +196,8 @@
"ForceReturnTestsTwo", "LogicalStructures", "BreakpointListenerTest", "LaunchHistoryTest", "LaunchHistoryTest2", "RunnableAppletImpl", "java6.AllInstancesTests",
"bug329294", "bug401270", "org.eclipse.debug.tests.targets.HcrClass2", "org.eclipse.debug.tests.targets.HcrClass3", "org.eclipse.debug.tests.targets.HcrClass4",
"org.eclipse.debug.tests.targets.HcrClass5", "org.eclipse.debug.tests.targets.HcrClass6", "org.eclipse.debug.tests.targets.HcrClass7", "org.eclipse.debug.tests.targets.HcrClass8",
- "org.eclipse.debug.tests.targets.HcrClass9", "TestContributedStepFilterClass", "TerminateAll_01", "TerminateAll_02" };
+ "org.eclipse.debug.tests.targets.HcrClass9", "TestContributedStepFilterClass", "TerminateAll_01", "TerminateAll_02", "StepResult1",
+ "StepResult2", "StepResult3", "TriggerPoint_01" };
final String[] LAUNCH_CONFIG_NAMES_1_8 = {"LargeSourceFile"};
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
index c804c7b..4b4dd11 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,9 +11,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.debug.test.stepping.ForceReturnTests;
import org.eclipse.jdt.debug.test.stepping.StepFilterTests;
@@ -41,6 +38,7 @@
import org.eclipse.jdt.debug.tests.breakpoints.TestToggleBreakpointsTarget;
import org.eclipse.jdt.debug.tests.breakpoints.TestToggleBreakpointsTarget8;
import org.eclipse.jdt.debug.tests.breakpoints.ThreadFilterBreakpointsTests;
+import org.eclipse.jdt.debug.tests.breakpoints.TriggerPointBreakpointsTests;
import org.eclipse.jdt.debug.tests.breakpoints.TypeNameBreakpointTests;
import org.eclipse.jdt.debug.tests.breakpoints.WatchpointTests;
import org.eclipse.jdt.debug.tests.console.ConsoleTerminateAllActionTests;
@@ -127,6 +125,9 @@
import org.eclipse.jdt.debug.tests.variables.TestIntegerAccessUnboxing15;
import org.eclipse.jdt.debug.tests.variables.TestLogicalStructures;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
/**
* Tests for integration and nightly builds.
*/
@@ -189,6 +190,8 @@
addTest(new TestSuite(BreakpointLocationVerificationTests.class));
addTest(new TestSuite(RunToLineTests.class));
addTest(new TestSuite(TestToggleBreakpointsTarget.class));
+ addTest(new TestSuite(TriggerPointBreakpointsTests.class));
+
if (JavaProjectHelper.isJava8Compatible()) {
addTest(new TestSuite(TestToggleBreakpointsTarget8.class));
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java
new file mode 100644
index 0000000..37cc3d7
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.debug.tests.breakpoints;
+
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaStackFrame;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.tests.AbstractDebugTest;
+
+/**
+ * Tests trigger point of breakpoints
+ */
+public class TriggerPointBreakpointsTests extends AbstractDebugTest {
+
+ /**
+ * Constructor
+ * @param name
+ */
+ public TriggerPointBreakpointsTests(String name) {
+ super(name);
+ }
+
+ /**
+ * Tests the trigger point
+ *
+ * @throws Exception
+ */
+ public void testTriggerPointBreakpoint() throws Exception {
+ String typeName = "TriggerPoint_01";
+ IJavaLineBreakpoint bp1 = createLineBreakpoint(25, typeName);
+ IJavaLineBreakpoint bp2 = createLineBreakpoint(30, typeName);
+ bp2.setTriggerPoint(true);
+
+ IJavaThread thread= null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp2);
+
+ IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
+ IVariable var = findVariable(frame, "i");
+ assertNotNull("Could not find variable 'i'", var);
+
+ IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
+ assertNotNull("variable 'i' has no value", value);
+ int iValue = value.getIntValue();
+ assertTrue("value of 'i' should be '1', but was " + iValue, iValue == 1);
+
+ var = findVariable(frame, "j");
+ assertNotNull("Could not find variable 'j'", var);
+
+ value = (IJavaPrimitiveValue) var.getValue();
+ assertNotNull("variable 'j' has no value", value);
+ int jValue = value.getIntValue();
+ assertTrue("value of 'j' should be '1', but was " + jValue, jValue == 1);
+
+ bp1.delete();
+ bp2.delete();
+ } finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+}
diff --git a/org.eclipse.jdt.debug.ui/icons/full/obj16/methodresult_obj.png b/org.eclipse.jdt.debug.ui/icons/full/obj16/methodresult_obj.png
new file mode 100644
index 0000000..d2ea89a
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/icons/full/obj16/methodresult_obj.png
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/icons/full/obj16/methodresult_obj@2x.png b/org.eclipse.jdt.debug.ui/icons/full/obj16/methodresult_obj@2x.png
new file mode 100644
index 0000000..7ff6906
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/icons/full/obj16/methodresult_obj@2x.png
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_ovr.png b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_ovr.png
new file mode 100644
index 0000000..e0bf7d7
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_ovr.png
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_suppressed_ovr.png b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_suppressed_ovr.png
new file mode 100644
index 0000000..f05654f
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_suppressed_ovr.png
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/plugin.properties b/org.eclipse.jdt.debug.ui/plugin.properties
index 228f7bb..dada1dc 100644
--- a/org.eclipse.jdt.debug.ui/plugin.properties
+++ b/org.eclipse.jdt.debug.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2014 IBM Corporation and others.
+# Copyright (c) 2000, 2016 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -69,6 +69,10 @@
exitAction.label=E&xit
hitCount.label=&Hit Count...
+triggerPoint.label=Toggle Tri&gger
+triggerPoint.tooltip=Toggles the trigger point property of the selected breakpoint
+activateTriggerPoint.label=Toggle Acti&vate Trigger
+activateTriggerPoint.tooltip=Toggles the activation of trigger point property of the selected breakpoint
Inspect.label=Insp&ect
Inspect.tooltip=Inspect Result of Evaluating Selected Text
diff --git a/org.eclipse.jdt.debug.ui/plugin.xml b/org.eclipse.jdt.debug.ui/plugin.xml
index 24ee7d5..afe28cd 100644
--- a/org.eclipse.jdt.debug.ui/plugin.xml
+++ b/org.eclipse.jdt.debug.ui/plugin.xml
@@ -2568,12 +2568,7 @@
<adapt type="org.eclipse.jdt.core.IJavaElement">
<test property="org.eclipse.jdt.core.isInJavaProject"/>
</adapt>
- <or>
- <test property="org.eclipse.jdt.launching.extendsClass" args="java.applet.Applet"/>
- <test property="org.eclipse.jdt.launching.isContainer"/>
- <test property="org.eclipse.jdt.launching.isPackageFragment"/>
- <test property="org.eclipse.jdt.launching.isPackageFragmentRoot"/>
- </or>
+ <test property="org.eclipse.jdt.launching.extendsClass" args="java.applet.Applet"/>
</and>
</iterate>
</with>
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.java
index 2783787..a9b44b0 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.java
@@ -61,6 +61,7 @@
public static String JavaDebugPreferencePage_Suspend_execution_on_co_mpilation_errors_1;
public static String JavaDebugPreferencePage_Value_must_be_a_valid_integer_greater_than__0__ms_1;
public static String JavaDebugPreferencePage_Replace_classfiles_containing_compilation_errors_1;
+ public static String JavaDebugPreferencePage_ShowStepResult_1;
public static String JavaDebugPreferencePage_Communication_1;
public static String JavaDebugPreferencePage_Debugger__timeout__2;
public static String JavaDebugPreferencePage__Launch_timeout__ms___1;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties
index a99afe6..ac30067 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties
@@ -29,6 +29,7 @@
JavaDebugPreferencePage_Suspend_execution_on_co_mpilation_errors_1=Suspend execution on co&mpilation errors
JavaDebugPreferencePage_Value_must_be_a_valid_integer_greater_than__0__ms_1=Value must be a valid integer greater than or equal to {0} ms
JavaDebugPreferencePage_Replace_classfiles_containing_compilation_errors_1=Replace &classfiles containing compilation errors
+JavaDebugPreferencePage_ShowStepResult_1=S&how method result after a step operation (if supported by the VM; may be slow)
JavaDebugPreferencePage_Communication_1=Communication
JavaDebugPreferencePage_Debugger__timeout__2=Debugger &timeout (ms):
JavaDebugPreferencePage__Launch_timeout__ms___1=&Launch timeout (ms):
@@ -299,7 +300,7 @@
JavaDebugPreferencePage_promptWhenDeletingCondidtionalBreakpoint=&Prompt for confirmation when deleting a conditional breakpoint from editor
JavaDebugPreferencePage_0=See <a>''{0}''</a> for general debug settings.
JavaDebugPreferencePage_only_include_exported_entries=Onl&y include exported classpath entries when launching
-JavaDebugPreferencePage_filterUnrelatedBreakpoints=&Do not install breakpoints from unrelated projects
+JavaDebugPreferencePage_filterUnrelatedBreakpoints=Do ¬ install breakpoints from unrelated projects
JavaVariableLabelProvider_0=unavailable
EditLogicalStructureDialog_0=Qualified type &name:
EditLogicalStructureDialog_1=&Browse...
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java
index 8ea41f9..e42400f 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -57,6 +57,12 @@
/** Flag to render the synchronized stack frame adornment */
public final static int SYNCHRONIZED= 0x4000;
+ /** Flag to render the trigger point adornment */
+ public final static int TRIGGER_POINT = 0x10000;
+
+ /** Flag to render disabled due to trigger point adornment */
+ public final static int TRIGGER_SUPPRESSED = 0x20000;
+
private ImageDescriptor fBaseImage;
private int fFlags;
private Point fSize;
@@ -155,6 +161,21 @@
data= getImageData(JavaDebugImages.IMG_OVR_IN_DEADLOCK);
drawImage(data, x, y);
}
+ if ((flags & TRIGGER_POINT) != 0) {
+ x = getSize().x;
+ y = getSize().y;
+ data = getImageData(JavaDebugImages.IMG_OVR_IN_TRIGGER_POINT);
+ x -= data.width;
+ y -= data.height;
+ drawImage(data, x, y);
+ } else if ((flags & TRIGGER_SUPPRESSED) != 0) {
+ x = getSize().x;
+ y = getSize().y;
+ data = getImageData(JavaDebugImages.IMG_OVR_TRIGGER_SUPPRESSED);
+ x -= data.width;
+ y -= data.height;
+ drawImage(data, x, y);
+ }
if ((flags & OWNED_MONITOR) != 0) {
x= getSize().x;
y= getSize().y;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
index ec1781f..c1d21b7 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -64,6 +64,7 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.debug.core.breakpoints.JavaExceptionBreakpoint;
import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIAllInstancesValue;
+import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIReturnValueVariable;
import org.eclipse.jdt.internal.debug.core.model.JDIDebugModelMessages;
import org.eclipse.jdt.internal.debug.core.model.JDIReferenceListEntryVariable;
import org.eclipse.jdt.internal.debug.core.model.JDIReferenceListValue;
@@ -1045,6 +1046,11 @@
if (breakpoint.isInstalled()) {
flags |= JDIImageDescriptor.INSTALLED;
}
+ if (breakpoint.isTriggerPoint()) {
+ flags |= JDIImageDescriptor.TRIGGER_POINT;
+ } else if (!DebugPlugin.getDefault().getBreakpointManager().canSupendOnBreakpoint()) {
+ flags |= JDIImageDescriptor.TRIGGER_SUPPRESSED;
+ }
if (breakpoint instanceof IJavaLineBreakpoint) {
if (((IJavaLineBreakpoint)breakpoint).isConditionEnabled()) {
flags |= JDIImageDescriptor.CONDITIONAL;
@@ -1098,6 +1104,9 @@
// no need to log errors - elements may no longer exist by the time we render them
}
}
+ if (javaVariable instanceof JDIReturnValueVariable) {
+ return JavaDebugImages.getImageDescriptor(JavaDebugImages.IMG_OBJS_METHOD_RESULT);
+ }
return JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_DEFAULT);
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java
index b095e6c..d8cd786 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java
@@ -41,6 +41,7 @@
public static final String IMG_OVR_BREAKPOINT_INSTALLED_DISABLED= "IMG_OBJS_BREAKPOINT_INSTALLED_DISABLED"; //$NON-NLS-1$
public static final String IMG_OBJS_LOCAL_VARIABLE = "IMG_OBJS_LOCAL_VARIABLE"; //$NON-NLS-1$
+ public static final String IMG_OBJS_METHOD_RESULT = "IMG_OBJS_METHOD_RESULT"; //$NON-NLS-1$
public static final String IMG_OVR_METHOD_BREAKPOINT_ENTRY= "IMG_OBJS_METHOD_BREAKPOINT_ENTRY"; //$NON-NLS-1$
public static final String IMG_OVR_METHOD_BREAKPOINT_ENTRY_DISABLED= "IMG_OBJS_METHOD_BREAKPOINT_ENTRY_DISABLED"; //$NON-NLS-1$
@@ -100,6 +101,10 @@
public static final String IMG_ELCL_ALL_REFERENCES = "IMG_ELCL_ALL_REFERENCES"; //$NON-NLS-1$
+ public static final String IMG_OVR_IN_TRIGGER_POINT = "IMG_OVR_IN_TRIGGER_POINT"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_TRIGGER_SUPPRESSED = "IMG_OVR_TRIGGER_SUPPRESSED"; //$NON-NLS-1$
+
/*
* Set of predefined Image Descriptors.
*/
@@ -152,6 +157,7 @@
declareRegistryImage(IMG_OBJS_REFERENCE, T_OBJ + "reference_obj.gif"); //$NON-NLS-1$
declareRegistryImage(IMG_OBJS_LOCAL_VARIABLE, T_OBJ + "localvariable_obj.png"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_METHOD_RESULT, T_OBJ + "methodresult_obj.png"); //$NON-NLS-1$
declareRegistryImage(IMG_OVR_METHOD_BREAKPOINT_ENTRY, T_OVR + "entry_ovr.png"); //$NON-NLS-1$
declareRegistryImage(IMG_OVR_METHOD_BREAKPOINT_ENTRY_DISABLED, T_OVR + "entry_ovr_disabled.png"); //$NON-NLS-1$
@@ -210,6 +216,11 @@
declareRegistryImage(IMG_ELCL_AUTO_FORMAT, E_LCL + "autoform_menu.png"); //$NON-NLS-1$
declareRegistryImage(IMG_ELCL_ALL_REFERENCES, E_LCL + "all_references.png"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_IN_TRIGGER_POINT, T_OVR + "trigger_ovr.png"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_TRIGGER_SUPPRESSED, T_OVR + "trigger_suppressed_ovr.png"); //$NON-NLS-1$
+
}
/**
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugPreferencePage.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugPreferencePage.java
index 46bcbc6..423452f 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugPreferencePage.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugPreferencePage.java
@@ -89,6 +89,8 @@
private Button fAlertHCRNotSupportedButton;
private Button fAlertObsoleteButton;
private Button fPerformHCRWithCompilationErrors;
+ private Button fShowStepResult;
+
// Timeout preference widgets
private JavaDebugIntegerFieldEditor fTimeoutText;
private JavaDebugIntegerFieldEditor fConnectionTimeoutText;
@@ -164,8 +166,12 @@
SWTFactory.createVerticalSpacer(composite, 1);
fOnlyIncludeExportedEntries = SWTFactory.createCheckButton(composite, DebugUIMessages.JavaDebugPreferencePage_only_include_exported_entries, null, false, 1);
+
+ SWTFactory.createVerticalSpacer(composite, 1);
+ fShowStepResult = SWTFactory.createCheckButton(composite, DebugUIMessages.JavaDebugPreferencePage_ShowStepResult_1, null, false, 1);
setValues();
+
fTimeoutText.setPropertyChangeListener(this);
fConnectionTimeoutText.setPropertyChangeListener(this);
return composite;
@@ -202,6 +208,7 @@
prefs.putInt(JDIDebugPlugin.PREF_DEFAULT_BREAKPOINT_SUSPEND_POLICY, policy);
prefs.putInt(JDIDebugPlugin.PREF_DEFAULT_WATCHPOINT_SUSPEND_POLICY, fWatchpoint.getSelectionIndex());
prefs.putBoolean(JDIDebugModel.PREF_HCR_WITH_COMPILATION_ERRORS, fPerformHCRWithCompilationErrors.getSelection());
+ prefs.putBoolean(JDIDebugModel.PREF_SHOW_STEP_RESULT, fShowStepResult.getSelection());
prefs.putInt(JDIDebugModel.PREF_REQUEST_TIMEOUT, fTimeoutText.getIntValue());
prefs.putBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, fFilterUnrelatedBreakpoints.getSelection());
try {
@@ -246,6 +253,7 @@
fSuspendVMorThread.select((value == IJavaBreakpoint.SUSPEND_THREAD) ? 0 : 1);
fWatchpoint.select(prefs.getInt(JDIDebugPlugin.PREF_DEFAULT_WATCHPOINT_SUSPEND_POLICY, 0));
fPerformHCRWithCompilationErrors.setSelection(prefs.getBoolean(JDIDebugModel.PREF_HCR_WITH_COMPILATION_ERRORS, true));
+ fShowStepResult.setSelection(prefs.getBoolean(JDIDebugModel.PREF_SHOW_STEP_RESULT, true));
fTimeoutText.setStringValue(new Integer(prefs.getInt(JDIDebugModel.PREF_REQUEST_TIMEOUT, JDIDebugModel.DEF_REQUEST_TIMEOUT)).toString());
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true));
}
@@ -278,6 +286,7 @@
fSuspendVMorThread.select((value == IJavaBreakpoint.SUSPEND_THREAD ? 0 : 1));
fWatchpoint.select(prefs.getInt(JDIDebugPlugin.PREF_DEFAULT_WATCHPOINT_SUSPEND_POLICY, 0));
fPerformHCRWithCompilationErrors.setSelection(prefs.getBoolean(JDIDebugModel.PREF_HCR_WITH_COMPILATION_ERRORS, true));
+ fShowStepResult.setSelection(prefs.getBoolean(JDIDebugModel.PREF_SHOW_STEP_RESULT, true));
fTimeoutText.setStringValue(new Integer(prefs.getInt(JDIDebugModel.PREF_REQUEST_TIMEOUT, JDIDebugModel.DEF_REQUEST_TIMEOUT)).toString());
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true));
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java
index 2a19cf0..6a3b187 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,6 +30,7 @@
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY,
+ StandardJavaBreakpointEditor.PROP_TRIGGER_POINT,
ExceptionBreakpointEditor.PROP_CAUGHT,
ExceptionBreakpointEditor.PROP_UNCAUGHT,
ExceptionBreakpointEditor.PROP_SUBCLASSES
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java
index 5cd8d2a..38e07f2 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * Copyright (c) 2010, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@
JavaBreakpointConditionEditor.PROP_CONDITION_ENABLED,
JavaBreakpointConditionEditor.PROP_CONDITION_SUSPEND_POLICY,
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
- StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY});
+ StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY, StandardJavaBreakpointEditor.PROP_TRIGGER_POINT });
}
/* (non-Javadoc)
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java
index 57a94a7..d354d42 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,7 @@
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY,
+ StandardJavaBreakpointEditor.PROP_TRIGGER_POINT,
MethodBreakpointEditor.PROP_ENTRY,
MethodBreakpointEditor.PROP_EXIT,
JavaBreakpointConditionEditor.PROP_CONDITION_ENABLED,
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java
index 654ce3f..293c495 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java
@@ -38,9 +38,9 @@
*/
@Override
public Control createControl(Composite parent) {
- Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 2, 1, 0, 0, 0);
+ Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, 0, 0, 0);
// add standard controls
- super.createStandardControls(composite);
+ super.createControl(composite);
Composite watchComp = SWTFactory.createComposite(composite, parent.getFont(), 3, 1, 0, 0, 0);
fEntry = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_10), PROP_ENTRY);
fExit = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_11), PROP_EXIT);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java
index 2154d65..506f443 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,7 +29,7 @@
super(BreakpointMessages.StandardBreakpointDetailPane_0, BreakpointMessages.StandardBreakpointDetailPane_0, DETAIL_PANE_STANDARD);
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
- StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY});
+ StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY, StandardJavaBreakpointEditor.PROP_TRIGGER_POINT, });
}
/* (non-Javadoc)
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java
index 6dcadf7..b1a9e39 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.jdt.debug.core.IJavaBreakpoint;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
@@ -40,6 +41,7 @@
private Text fHitCountText;
private Button fSuspendThread;
private Button fSuspendVM;
+ protected Button fTriggerPointButton;
/**
* Property id for hit count enabled state.
@@ -56,14 +58,45 @@
*/
public static final int PROP_SUSPEND_POLICY = 0x1007;
+ /**
+ * Property id for trigger point.
+ */
+ public static final int PROP_TRIGGER_POINT = 0x1008;
+
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.debug.ui.breakpoints.AbstractJavaBreakpointEditor#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public Control createControl(Composite parent) {
+ createTriggerPointButton(parent);
return createStandardControls(parent);
}
+
+ protected Button createCheckButton(Composite parent, String text) {
+ return SWTFactory.createCheckButton(parent, text, null, false, 1);
+ }
+ /**
+ * Creates the button to toggle Triggering point property of the breakpoint
+ *
+ * @param parent
+ * the parent composite
+ */
+ protected void createTriggerPointButton(Composite parent) {
+ Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, 0, 0, 0);
+ fTriggerPointButton = createCheckButton(composite, PropertyPageMessages.JavaBreakpointPage_12);
+
+ fTriggerPointButton.setSelection(isTriggerPoint());
+ fTriggerPointButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ setDirty(PROP_TRIGGER_POINT);
+ }
+
+ });
+
+ }
+
protected Control createStandardControls(Composite parent) {
Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 4, 1, 0, 0, 0);
fHitCountButton = SWTFactory.createCheckButton(composite, processMnemonics(PropertyPageMessages.JavaBreakpointPage_4), null, false, 1);
@@ -169,6 +202,8 @@
fSuspendVM.setEnabled(enabled);
fSuspendThread.setSelection(suspendThread);
fSuspendVM.setSelection(!suspendThread);
+ fTriggerPointButton.setEnabled(enabled);
+ fTriggerPointButton.setSelection(isTriggerPoint());
setDirty(false);
}
@@ -210,6 +245,8 @@
}
}
fBreakpoint.setHitCount(hitCount);
+ storeTriggerPoint(fBreakpoint);
+
}
setDirty(false);
}
@@ -256,4 +293,36 @@
});
return button;
}
+
+ private boolean isTriggerPoint() {
+ try {
+ if (getBreakpoint() != null) {
+ return getBreakpoint().isTriggerPoint();
+ }
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return false;
+
+ }
+
+
+ /**
+ * Stores the value of the trigger point state in the breakpoint manager.
+ *
+ * @param breakpoint
+ * the breakpoint to be compared with trigger point in the workspace
+ * @throws CoreException
+ * if an exception occurs while setting the enabled state
+ */
+ private void storeTriggerPoint(IJavaBreakpoint breakpoint) throws CoreException {
+ boolean oldSelection = breakpoint.isTriggerPoint();
+ if (oldSelection == fTriggerPointButton.getSelection()) {
+ return;
+ }
+ breakpoint.setTriggerPoint(fTriggerPointButton.getSelection());
+ DebugPlugin.getDefault().getBreakpointManager().refreshTriggerpointDisplay();
+ }
+
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
index 9c0914f..a84eac2 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,6 +30,7 @@
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY,
+ StandardJavaBreakpointEditor.PROP_TRIGGER_POINT,
WatchpointEditor.PROP_ACCESS,
WatchpointEditor.PROP_MODIFICATION
});
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java
index 81145a8..e36bdb8 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java
@@ -41,7 +41,7 @@
public Control createControl(Composite parent) {
Composite container = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, 0, 0, 0);
// add standard controls
- super.createStandardControls(container);
+ super.createControl(container);
Composite watchComp = SWTFactory.createComposite(container, parent.getFont(), 2, 1, 0, 0, 0);
fAccess = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_7), PROP_ACCESS);
fModification = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_8), PROP_MODIFICATION);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
index 1361494..6942df7 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -64,6 +64,9 @@
protected JavaElementLabelProvider fJavaLabelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
protected Button fEnabledButton;
+ /*
+ * protected Button fTriggerPointButton; protected Button fTriggerPointButtonActive;
+ */
protected List<String> fErrorMessages= new ArrayList<String>();
protected String fPrevMessage = null;
private AbstractJavaBreakpointEditor fEditor;
@@ -148,6 +151,8 @@
*/
protected void doStore() throws CoreException {
IJavaBreakpoint breakpoint = getBreakpoint();
+ // storeTriggerPoint(breakpoint);
+ // storeTriggerPointActive(breakpoint);
storeEnabled(breakpoint);
if (fEditor.isDirty()) {
fEditor.doSave();
@@ -174,7 +179,10 @@
Composite mainComposite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_HORIZONTAL, 0, 0);
createLabels(mainComposite);
createLabel(mainComposite, ""); //$NON-NLS-1$ // spacer
- createEnabledButton(mainComposite);
+
+ Composite composite = SWTFactory.createComposite(mainComposite, parent.getFont(), 4, 1, 0, 0, 0);
+ createEnabledButton(composite);
+
createTypeSpecificEditors(mainComposite);
setValid(true);
// if this breakpoint is being created, change the shell title to indicate 'creation'
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java
index e0a802c..63597fb 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,6 +47,8 @@
public static String JavaBreakpointPage_10;
public static String JavaBreakpointPage_11;
+ public static String JavaBreakpointPage_12;
+ public static String JavaBreakpointPage_13;
public static String JavaBreakpointPage_3;
public static String JavaBreakpointPage_4;
public static String JavaBreakpointPage_5;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties
index 68cf3c8..e0380dc 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties
@@ -36,6 +36,8 @@
JavaBreakpointPage_0=Hit count must be a positive integer
JavaBreakpointPage_10=Create Breakpoint for {0}
JavaBreakpointPage_11=Class Prepare Breakpoint
+JavaBreakpointPage_12=Trigger Point
+JavaBreakpointPage_13=Active Trigger
JavaBreakpointPage_3=&Type:
JavaBreakpointPage_4=&Hit count:
JavaBreakpointPage_5=&Enabled
diff --git a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
index 80f4252..24d1ba3 100644
--- a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug; singleton:=true
-Bundle-Version: 3.10.100.qualifier
+Bundle-Version: 3.11.0.qualifier
Bundle-ClassPath: jdi.jar,
jdimodel.jar,
tools.jar
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
index c11b22d..1bfadb1 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
@@ -102,6 +102,14 @@
+ ".do_not_install_breakpoints_from_unrelated_sources"; //$NON-NLS-1$
/**
+ * Preference key for specifying if the value returned or thrown should be displayed as variable after a "step return" or "step over" (if
+ * supported by the vm)
+ * @since 3.11
+ */
+ public static final String PREF_SHOW_STEP_RESULT = getPluginIdentifier()
+ + ".PREF_SHOW_STEP_RESULT"; //$NON-NLS-1$
+
+ /**
* Not to be instantiated.
*/
private JDIDebugModel() {
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIDebugPluginPreferenceInitializer.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIDebugPluginPreferenceInitializer.java
index 5430040..a7062c6 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIDebugPluginPreferenceInitializer.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIDebugPluginPreferenceInitializer.java
@@ -42,5 +42,6 @@
node.putInt(JDIDebugPlugin.PREF_ALL_REFERENCES_MAX_COUNT, 100);
node.putInt(JDIDebugPlugin.PREF_ALL_INSTANCES_MAX_COUNT, 100);
node.putBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true);
+ node.putBoolean(JDIDebugModel.PREF_SHOW_STEP_RESULT, true);
}
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
index bac8583..585417e 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -106,6 +106,15 @@
* @since 3.5
*/
public static final String BREAKPOINT_LISTENERS = JDIDebugPlugin.EXTENSION_POINT_JAVA_BREAKPOINT_LISTENERS;
+ /**
+ * Breakpoint attribute storing the expired value of trigger point (value
+ * <code>"org.eclipse.jdt.debug.core.expiredTriggerPoint"</code>). This attribute is
+ * stored as a <code>boolean</code>. Once a trigger point is hit, a
+ * breakpoint is considered to be "expired" as trigger point for the session.
+ *
+ * @since 3.11
+ */
+ public static final String EXPIRED_TRIGGER_POINT = "org.eclipse.jdt.debug.core.expiredTriggerPoint"; //$NON-NLS-1$
/**
* Stores the collection of requests that this breakpoint has installed in
@@ -167,7 +176,7 @@
*/
protected static final String[] fgExpiredEnabledAttributes = new String[] {
EXPIRED, ENABLED };
-
+
public JavaBreakpoint() {
fRequestsByTarget = new HashMap<JDIDebugTarget, List<EventRequest>>(1);
fFilteredThreadsByTarget = new HashMap<JDIDebugTarget, IJavaThread>(1);
@@ -393,6 +402,7 @@
public boolean handleBreakpointEvent(Event event, JDIThread thread,
boolean suspendVote) {
expireHitCount(event);
+ disableTriggerPoint(event);
return !suspend(thread, suspendVote); // Resume if suspend fails
}
@@ -466,6 +476,19 @@
}
}
}
+
+ protected void disableTriggerPoint(Event event) {
+ try{
+ if (isTriggerPoint() && isEnabled()) {
+ DebugPlugin.getDefault().getBreakpointManager().enableTriggerpoints(null, false);
+ // make a note that we auto-disabled the trigger point for this breakpoint.
+ // we re enable it at cleanup of JDITarget
+ }
+ }catch (CoreException ce) {
+ JDIDebugPlugin.log(ce);
+ }
+
+ }
/**
* Returns whether this breakpoint should be "skipped". Breakpoints are
@@ -860,6 +883,13 @@
public int getInstallCount() throws CoreException {
return ensureMarker().getAttribute(INSTALL_COUNT, 0);
}
+
+ /**
+ * Returns whether this trigger breakpoint has expired.
+ */
+ public boolean isTriggerPointExpired() throws CoreException {
+ return ensureMarker().getAttribute(EXPIRED_TRIGGER_POINT, false);
+ }
/**
* Decrements the install count of this breakpoint.
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
index 7cebf50..1bf05be 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
@@ -368,6 +368,7 @@
}
}
setExceptionName(name);
+ disableTriggerPoint(event);
if (getExclusionClassFilters().length >= 1
|| getInclusionClassFilters().length >= 1
|| filtersIncludeDefaultPackage(fInclusionClassFilters)
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
index 7366f16..b56ae2b 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
@@ -449,6 +449,7 @@
protected boolean suspendForEvent(Event event, JDIThread thread,
boolean suspendVote) {
expireHitCount(event);
+ disableTriggerPoint(event);
return suspend(thread, suspendVote);
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
index 73215fc..df30d52 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
@@ -431,11 +431,13 @@
if (event instanceof MethodEntryEvent) {
MethodEntryEvent entryEvent = (MethodEntryEvent) event;
fLastEventTypes.put(thread.getDebugTarget(), ENTRY_EVENT);
+ //inActivateTriggerPoint(event);
return handleMethodEvent(entryEvent, entryEvent.method(), thread,
suspendVote);
} else if (event instanceof MethodExitEvent) {
MethodExitEvent exitEvent = (MethodExitEvent) event;
fLastEventTypes.put(thread.getDebugTarget(), EXIT_EVENT);
+ //inActivateTriggerPoint(event);
return handleMethodEvent(exitEvent, exitEvent.method(), thread,
suspendVote);
} else if (event instanceof BreakpointEvent) {
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JDIReturnValueVariable.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JDIReturnValueVariable.java
new file mode 100644
index 0000000..cb7376c
--- /dev/null
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JDIReturnValueVariable.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Till Brychcy and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Till Brychcy - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.debug.core.logicalstructures;
+
+import org.eclipse.jdt.debug.core.IJavaValue;
+
+/**
+ * Represents the return value after a "step-return".
+ */
+public class JDIReturnValueVariable extends JDIPlaceholderVariable {
+
+ public JDIReturnValueVariable(String name, IJavaValue value) {
+ super(name, value);
+ }
+}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java
index a958b58..50e19d0 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -123,6 +123,8 @@
public static String JDIStackFrame_exception_retrieving_visible_variables;
public static String JDIStackFrame_pop_frame_not_supported;
public static String JDIStackFrame_Variable_information_unavailable_for_native_methods;
+ public static String JDIStackFrame_ReturnValue;
+ public static String JDIStackFrame_ExceptionThrown;
public static String JDIThisVariable_exception_while_retrieving_type_this;
public static String JDIThisVariableexception_retrieving_reference_type_name;
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties
index 84f8758..a3d5bb5 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2016 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -91,6 +91,8 @@
JDIStackFrame_exception_retrieving_visible_variables={0} occurred retrieving visible variables.
JDIStackFrame_pop_frame_not_supported=Popping frames not supported.
JDIStackFrame_Variable_information_unavailable_for_native_methods=Variable information unavailable for native methods
+JDIStackFrame_ReturnValue={0}() returned
+JDIStackFrame_ExceptionThrown={0}() threw
JDIThisVariable_exception_while_retrieving_type_this={0} occurred while retrieving type ''this''.
JDIThisVariableexception_retrieving_reference_type_name={0} occurred retrieving reference type name.
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
index 4971e50..9d930d4 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
@@ -1863,6 +1863,7 @@
plugin.getBreakpointManager().removeBreakpointManagerListener(this);
plugin.removeDebugEventListener(this);
removeAllBreakpoints();
+ DebugPlugin.getDefault().getBreakpointManager().enableTriggerpoints(null, true);
fOutOfSynchTypes.clear();
if (fEngines != null) {
Iterator<IAstEvaluationEngine> engines = fEngines.values().iterator();
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
index ea30bf5..c03279d 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,6 +46,7 @@
import org.eclipse.jdt.debug.core.IJavaVariable;
import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
+import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIReturnValueVariable;
import com.ibm.icu.text.MessageFormat;
import com.sun.jdi.AbsentInformationException;
@@ -123,6 +124,11 @@
private Location fLocation;
/**
+ * Whether the current stack frame is the top of the stack
+ */
+ private boolean fIsTop;
+
+ /**
* Creates a new stack frame in the given thread.
*
* @param thread
@@ -163,6 +169,7 @@
// mark as invalid
fDepth = -1;
fStackFrame = null;
+ fIsTop = false;
return null;
} else if (fDepth == depth) {
Location location = frame.location();
@@ -354,6 +361,7 @@
(JDIDebugTarget) getDebugTarget(), t));
}
}
+ addStepReturnValue(fVariables);
// add locals
Iterator<LocalVariable> variables = getUnderlyingVisibleVariables()
.iterator();
@@ -370,6 +378,34 @@
}
/**
+ * If there is a return value from a "step return" that belongs to this frame, insert it as first element
+ *
+ * @param variables
+ */
+ private void addStepReturnValue(List<IJavaVariable> variables) {
+ if (fIsTop) {
+ StepResult stepResult = fThread.fStepResult;
+ if (stepResult != null) {
+ if (stepResult.fIsReturnValue) {
+ if (fDepth + 1 != stepResult.fTargetFrameCount) {
+ // can happen e.g., because of checkPackageAccess/System.getSecurityManager()
+ return;
+ }
+ String name = MessageFormat.format(JDIDebugModelMessages.JDIStackFrame_ReturnValue, stepResult.fMethod.name());
+ variables.add(0, new JDIReturnValueVariable(name, JDIValue.createValue(getJavaDebugTarget(), stepResult.fValue)));
+ } else {
+ if (fDepth + 1 > stepResult.fTargetFrameCount) {
+ // don't know if this really can happen, but other jvm suprises were not expected either
+ return;
+ }
+ String name = MessageFormat.format(JDIDebugModelMessages.JDIStackFrame_ExceptionThrown, stepResult.fMethod.name());
+ variables.add(0, new JDIReturnValueVariable(name, JDIValue.createValue(getJavaDebugTarget(), stepResult.fValue)));
+ }
+ }
+ }
+ }
+
+ /**
* @see IStackFrame#getName()
*/
@Override
@@ -518,6 +554,11 @@
return;
}
+ // remove old return value first, so the "this" updating logic below works
+ if (!fVariables.isEmpty() && fVariables.get(0) instanceof JDIReturnValueVariable) {
+ fVariables.remove(0);
+ }
+
Method method = getUnderlyingMethod();
int index = 0;
if (!method.isStatic()) {
@@ -600,6 +641,8 @@
JDILocalVariable local = new JDILocalVariable(this, newOnes.next());
fVariables.add(local);
}
+
+ addStepReturnValue(fVariables);
}
/**
@@ -1504,4 +1547,7 @@
}
}
+ public void setIsTop(boolean isTop) {
+ this.fIsTop = isTop;
+ }
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
index 31d1025..8797935 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
@@ -79,9 +79,15 @@
import com.sun.jdi.Value;
import com.sun.jdi.event.Event;
import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ExceptionEvent;
+import com.sun.jdi.event.MethodEntryEvent;
+import com.sun.jdi.event.MethodExitEvent;
import com.sun.jdi.event.StepEvent;
import com.sun.jdi.request.EventRequest;
import com.sun.jdi.request.EventRequestManager;
+import com.sun.jdi.request.ExceptionRequest;
+import com.sun.jdi.request.MethodEntryRequest;
+import com.sun.jdi.request.MethodExitRequest;
import com.sun.jdi.request.StepRequest;
/**
@@ -249,6 +255,46 @@
private ThreadJob fRunningAsyncJob;
/**
+ * The current MethodExitRequest if a step-return or step-over is in progress.
+ */
+ private MethodExitRequest fCurrentMethodExitRequest;
+
+ /**
+ * The current ExceptionRequest if a step-return or step-over is in progress.
+ */
+ private ExceptionRequest fCurrentExceptionRequest;
+
+ /**
+ * The current MethodEntryRequest if a step-over is in progress.
+ */
+ private MethodEntryRequest fCurrentMethodEntryRequest;
+
+ /**
+ * Method for which a result value is expected
+ */
+ private Method fStepResultMethod;
+
+ /**
+ * The location if a step-over is in progress.
+ */
+ private Location fStepOverLocation;
+
+ /**
+ * The depth if a step-over is in progress.
+ */
+ private int fStepOverFrameCount;
+
+ /**
+ * Candidate for depth of stack that will be returned values belong to. Is copied to fStepReturnTargetDepth only when step-return is actually
+ * observed
+ */
+ private int fStepReturnTargetFrameCount;
+
+ private StepResult fStepResultCandidate;
+
+ StepResult fStepResult;
+
+ /**
* Creates a new thread on the underlying thread reference in the given
* debug target.
*
@@ -573,6 +619,9 @@
} else if (refreshChildren) {
List<StackFrame> frames = getUnderlyingFrames();
int oldSize = fStackFrames.size();
+ if (oldSize > 0) {
+ ((JDIStackFrame) fStackFrames.get(0)).setIsTop(false);
+ }
int newSize = frames.size();
int discard = oldSize - newSize; // number of old frames to
// discard, if any
@@ -604,7 +653,9 @@
}
offset--;
}
-
+ if (newSize > 0) {
+ ((JDIStackFrame) fStackFrames.get(0)).setIsTop(true);
+ }
}
fRefreshChildren = false;
} else {
@@ -1377,6 +1428,18 @@
}
}
+ try {
+ if (!(breakpoint.isTriggerPoint())) {
+ if (!DebugPlugin.getDefault().getBreakpointManager().canSupendOnBreakpoint()){
+ fSuspendVoteInProgress = false;
+ return false;
+ }
+
+ }
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
// Evaluate breakpoint condition (if any). The condition is evaluated
// regardless of the current suspend vote status, since breakpoint
// listeners
@@ -1634,6 +1697,7 @@
}
try {
setRunning(true);
+ clearStepReturnResult();
if (fireNotification) {
fireResumeEvent(DebugEvent.CLIENT_REQUEST);
}
@@ -1664,6 +1728,10 @@
}
}
+ private void clearStepReturnResult() {
+ fStepResult = null;
+ }
+
/**
* Preserves stack frames to be used on the next suspend event. Iterates
* through all current stack frames, setting their state as invalid. This
@@ -2001,6 +2069,7 @@
protected synchronized void resumedByVM() throws DebugException {
fClientSuspendRequest = false;
setRunning(true);
+ clearStepReturnResult();
preserveStackFrames();
// This method is called *before* the VM is actually resumed.
// To ensure that all threads will fully resume when the VM
@@ -2375,6 +2444,7 @@
setPendingStepHandler(this);
addJDIEventListener(this, getStepRequest());
setRunning(true);
+ clearStepReturnResult();
preserveStackFrames();
fireResumeEvent(getStepDetail());
invokeThread();
@@ -2459,6 +2529,81 @@
request.addCountFilter(1);
attachFiltersToStepRequest(request);
request.enable();
+
+ if (manager.virtualMachine().canGetMethodReturnValues() && showStepResultIsEnabled()) {
+ if (fCurrentMethodExitRequest != null) {
+ removeJDIEventListener(this, fCurrentMethodExitRequest);
+ manager.deleteEventRequest(fCurrentMethodExitRequest);
+ fCurrentMethodExitRequest = null;
+ }
+ if (fCurrentExceptionRequest != null) {
+ removeJDIEventListener(this, fCurrentExceptionRequest);
+ manager.deleteEventRequest(fCurrentExceptionRequest);
+ fCurrentExceptionRequest = null;
+ }
+ if (fCurrentMethodEntryRequest != null) {
+ removeJDIEventListener(this, fCurrentMethodEntryRequest);
+ manager.deleteEventRequest(fCurrentMethodEntryRequest);
+ fCurrentMethodEntryRequest = null;
+ }
+ fStepResultCandidate = null;
+ List<IJavaStackFrame> frames = computeStackFrames();
+ int frameCount = 0;
+ StackFrame currentFrame = null;
+ if (!frames.isEmpty()) {
+ frameCount = frames.size();
+ currentFrame = ((JDIStackFrame) frames.get(0)).getUnderlyingStackFrame();
+ } else {
+ // can happen, e.g. when step filters are active.
+ if (fThread.isSuspended()) {
+ try {
+ // try to get the required info from the underlying object.
+ frameCount = fThread.frameCount();
+ currentFrame = fThread.frame(0);
+ }
+ catch (IncompatibleThreadStateException e) {
+ // cannot not happen because of the enclosing isSuspended() check.
+ e.printStackTrace();
+ }
+ }
+ }
+ if (currentFrame != null) {
+ MethodExitRequest methodExitRequest = manager.createMethodExitRequest();
+ methodExitRequest.addThreadFilter(fThread);
+ methodExitRequest.addClassFilter(currentFrame.location().declaringType());
+
+ if (manager.virtualMachine().canUseInstanceFilters()) {
+ ObjectReference thisObject = currentFrame.thisObject();
+ if (thisObject != null) {
+ methodExitRequest.addInstanceFilter(thisObject);
+ }
+ }
+ methodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
+ methodExitRequest.enable();
+ fCurrentMethodExitRequest = methodExitRequest;
+ fStepResultMethod = currentFrame.location().method();
+ fStepReturnTargetFrameCount = frameCount - 1; // depth of the frame that is returned to
+ addJDIEventListener(this, methodExitRequest);
+
+ ExceptionRequest exceptionRequest = manager.createExceptionRequest(null, true, true);
+ exceptionRequest.addThreadFilter(fThread);
+ exceptionRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
+ exceptionRequest.enable();
+ fCurrentExceptionRequest = exceptionRequest;
+ addJDIEventListener(this, exceptionRequest);
+
+ if (kind == StepRequest.STEP_OVER) {
+ MethodEntryRequest methodEntryRequest = manager.createMethodEntryRequest();
+ methodEntryRequest.addThreadFilter(fThread);
+ methodEntryRequest.enable();
+ methodEntryRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
+ fCurrentMethodEntryRequest = methodEntryRequest;
+ fStepOverLocation = currentFrame.location();
+ fStepOverFrameCount = frameCount; // depth of the frame where the step-over is being done
+ addJDIEventListener(this, methodEntryRequest);
+ }
+ }
+ }
return request;
} catch (RuntimeException e) {
targetRequestFailed(
@@ -2473,6 +2618,10 @@
}
+ private boolean showStepResultIsEnabled() {
+ return Platform.getPreferencesService().getBoolean(JDIDebugPlugin.getUniqueIdentifier(), JDIDebugModel.PREF_SHOW_STEP_RESULT, true, null);
+ }
+
/**
* Returns the kind of step this handler implements.
*
@@ -2519,6 +2668,30 @@
*/
protected void deleteStepRequest() {
try {
+ if (fCurrentMethodExitRequest != null) {
+ removeJDIEventListener(this, fCurrentMethodExitRequest);
+ EventRequestManager manager = getEventRequestManager();
+ if (manager != null) {
+ manager.deleteEventRequest(fCurrentMethodExitRequest);
+ }
+ fCurrentMethodExitRequest = null;
+ }
+ if (fCurrentExceptionRequest != null) {
+ removeJDIEventListener(this, fCurrentExceptionRequest);
+ EventRequestManager manager = getEventRequestManager();
+ if (manager != null) {
+ manager.deleteEventRequest(fCurrentExceptionRequest);
+ }
+ fCurrentExceptionRequest = null;
+ }
+ if (fCurrentMethodEntryRequest != null) {
+ removeJDIEventListener(this, fCurrentMethodEntryRequest);
+ EventRequestManager manager = getEventRequestManager();
+ if (manager != null) {
+ manager.deleteEventRequest(fCurrentMethodEntryRequest);
+ }
+ fCurrentMethodEntryRequest = null;
+ }
StepRequest req = getStepRequest();
if (req != null) {
removeJDIEventListener(this, req);
@@ -2596,9 +2769,67 @@
public boolean handleEvent(Event event, JDIDebugTarget target,
boolean suspendVote, EventSet eventSet) {
try {
+ if (event instanceof MethodExitEvent) {
+ Method stepResultMethod = fStepResultMethod;
+ if (stepResultMethod != null) {
+ MethodExitEvent methodExitEvent = (MethodExitEvent) event;
+ if (methodExitEvent.location().method().equals(stepResultMethod)) {
+ fStepResultCandidate = new StepResult(fStepResultMethod, fStepReturnTargetFrameCount, methodExitEvent.returnValue(), true);
+ }
+ return true;
+ }
+ }
+ if (event instanceof ExceptionEvent) {
+ ExceptionEvent exceptionEvent = (ExceptionEvent) event;
+ fStepResultCandidate = new StepResult(fStepResultMethod, fStepReturnTargetFrameCount, exceptionEvent.exception(), false);
+ return true;
+ }
+ if (event instanceof MethodEntryEvent) {
+ removeJDIEventListener(this, fCurrentMethodEntryRequest);
+ EventRequestManager manager = getEventRequestManager();
+ if (manager != null) {
+ manager.deleteEventRequest(fCurrentMethodEntryRequest);
+ }
+ fCurrentMethodEntryRequest = null;
+ deleteStepRequest();
+ createSecondaryStepRequest(StepRequest.STEP_OUT);
+ return true;
+ }
StepEvent stepEvent = (StepEvent) event;
Location currentLocation = stepEvent.location();
+ if (fStepResultCandidate != null) {
+ fStepResult = fStepResultCandidate;
+ fStepResultMethod = null;
+ fStepReturnTargetFrameCount = -1;
+ fStepResultCandidate = null;
+ }
+
+ if (getStepKind() == StepRequest.STEP_OVER) {
+ Location stepOverLocation2 = fStepOverLocation;
+ if (stepOverLocation2 != null && fStepOverFrameCount >= 0) {
+ int underlyingFrameCount = getUnderlyingFrameCount();
+ if (underlyingFrameCount > fStepOverFrameCount) {
+ // sometimes a MethodEntryEvent does not stop the thread but is delivered with another one grouped
+ // in an event set. in this situation, multiple step-returns must be done.
+ deleteStepRequest();
+ createSecondaryStepRequest(StepRequest.STEP_OUT);
+ return true;
+ }
+ if (underlyingFrameCount == fStepOverFrameCount && stepOverLocation2.method().equals(currentLocation.method())) {
+ int lineNumber = stepOverLocation2.lineNumber();
+ if (lineNumber != -1 && lineNumber == currentLocation.lineNumber()) {
+ // line has not changed yet (probably returned from invocation with STEP_OUT)
+ deleteStepRequest();
+ createSecondaryStepRequest(StepRequest.STEP_OVER);
+ return true;
+ }
+ }
+ fStepOverLocation = null;
+ fStepOverFrameCount = -1;
+ }
+ }
+
if (!target.isStepThruFilters()) {
if (shouldDoStepReturn()) {
deleteStepRequest();
@@ -2615,6 +2846,7 @@
setRunning(true);
deleteStepRequest();
createSecondaryStepRequest();
+ clearStepReturnResult();
return true;
// otherwise, we're done stepping
}
@@ -2776,6 +3008,8 @@
if (getStepRequest() != null) {
deleteStepRequest();
setPendingStepHandler(null);
+ fStepOverLocation = null;
+ fStepOverFrameCount = -1;
}
}
}
@@ -2955,6 +3189,7 @@
setRunning(true);
deleteStepRequest();
createSecondaryStepRequest();
+ clearStepReturnResult();
return true;
} catch (DebugException e) {
logError(e);
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/StepResult.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/StepResult.java
new file mode 100644
index 0000000..54a7c17
--- /dev/null
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/StepResult.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Till Brychcy and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Till Brychcy - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.internal.debug.core.model;
+
+import com.sun.jdi.Method;
+import com.sun.jdi.Value;
+
+public class StepResult {
+
+ public StepResult(Method method, int targetFrameCount, Value value, boolean isReturnValue) {
+ this.fMethod = method;
+ this.fTargetFrameCount = targetFrameCount;
+ this.fValue = value;
+ this.fIsReturnValue = isReturnValue;
+ }
+
+ /**
+ * The method that was being stepped-over or step-returned from.
+ */
+ public final Method fMethod;
+
+ /**
+ * If a step-return or step-over is in progress, this is the stack size at which the result value is expected.
+ */
+ public final int fTargetFrameCount;
+
+ /**
+ * Returned value or thrown exception after a step-return or step-over.
+ */
+ public final Value fValue;
+
+ /**
+ * Whether {@link #fValue} was returned or thrown
+ */
+ public final boolean fIsReturnValue;
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug/pom.xml b/org.eclipse.jdt.debug/pom.xml
index 0465a91..184b714 100644
--- a/org.eclipse.jdt.debug/pom.xml
+++ b/org.eclipse.jdt.debug/pom.xml
@@ -18,6 +18,6 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug</artifactId>
- <version>3.10.100-SNAPSHOT</version>
+ <version>3.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>