diff options
author | eutarass | 2009-11-12 00:40:13 +0000 |
---|---|---|
committer | eutarass | 2009-11-12 00:40:13 +0000 |
commit | 867ba794841fdb5d67b28d0a26e2c2b2e3101961 (patch) | |
tree | 50fa236835459006ff67fda0e7427f7942d3ad69 /plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf | |
parent | 2bdbe1e0826f84d5219619f4a3ad5ea16563598c (diff) | |
download | org.eclipse.tcf-867ba794841fdb5d67b28d0a26e2c2b2e3101961.tar.gz org.eclipse.tcf-867ba794841fdb5d67b28d0a26e2c2b2e3101961.tar.xz org.eclipse.tcf-867ba794841fdb5d67b28d0a26e2c2b2e3101961.zip |
TCF Agent:
1. CPU registers and stack frame basic handling is moved to a new separate module cpudefs.c
2. Architecture dependent CPU registers and stack frame definitions are moved into separate header files - cpudefs-mdep.h
3. Implemented stack unwinding using DWARF sections .debug_frame and .eh_frame
4. Changed year in copyright notices to 2009
TCF Debugger:
1. Fixed elements order in registers view.
2. Changed source level stepping logic to better support stepping over function epilogue.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf')
4 files changed, 65 insertions, 34 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java index 1b73dc20f..42d6cdfca 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java @@ -61,7 +61,7 @@ public abstract class TCFActionStepInto extends TCFAction implements IRunControl } } if (!state.validate(this)) return; - if (!state.getData().is_suspended) { + if (state.getData() == null || !state.getData().is_suspended) { exit(new Exception("Context is not suspended")); return; } @@ -160,10 +160,14 @@ public abstract class TCFActionStepInto extends TCFAction implements IRunControl } protected void exit(Throwable error) { + exit(error, "Step Into"); + } + + protected void exit(Throwable error, String reason) { if (exited) return; rc.removeListener(this); exited = true; - done("Step"); + done(reason); } public void containerResumed(String[] context_ids) { @@ -200,14 +204,13 @@ public abstract class TCFActionStepInto extends TCFAction implements IRunControl public void contextResumed(String context) { } - public void contextSuspended(String context, String pc, String reason, - Map<String, Object> params) { + public void contextSuspended(String context, String pc, String reason, Map<String,Object> params) { if (!context.equals(ctx.getID())) return; if (IRunControl.REASON_STEP.equals(reason)) { Protocol.invokeLater(this); } else { - exit(null); + exit(null, reason); } } } diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java index 5234b6429..77c6288d0 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java @@ -1,5 +1,6 @@ package org.eclipse.tm.internal.tcf.debug.actions; +import java.math.BigInteger; import java.util.HashMap; import java.util.Map; @@ -54,7 +55,7 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl. } } if (!state.validate(this)) return; - if (!state.getData().is_suspended) { + if (state.getData() == null || !state.getData().is_suspended) { exit(new Exception("Context is not suspended")); return; } @@ -107,6 +108,10 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl. } protected void exit(Throwable error) { + exit(error, "Step Out"); + } + + protected void exit(Throwable error, String reason) { if (exited) return; if (bp != null) { bps.remove(new String[]{ (String)bp.get(IBreakpoints.PROP_ID) }, new IBreakpoints.DoneCommand() { @@ -116,7 +121,7 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl. } rc.removeListener(this); exited = true; - done("Step"); + done(reason); } public void containerResumed(String[] context_ids) { @@ -155,6 +160,20 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl. public void contextSuspended(String context, String pc, String reason, Map<String,Object> params) { if (!context.equals(ctx.getID())) return; - exit(null); + if (isMyBreakpoint(pc, reason)) { + exit(null); + } + else { + exit(null, reason); + } + } + + private boolean isMyBreakpoint(String pc, String reason) { + if (bp == null) return false; + if (pc == null) return false; + if (!IRunControl.REASON_BREAKPOINT.equals(reason)) return false; + BigInteger x = new BigInteger(pc); + BigInteger y = new BigInteger((String)bp.get(IBreakpoints.PROP_LOCATION)); + return x.equals(y); } } diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java index 5f5760180..fdf4aab76 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java @@ -65,7 +65,7 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl } } if (!state.validate(this)) return; - if (!state.getData().is_suspended) { + if (state.getData() == null || !state.getData().is_suspended) { exit(new Exception("Context is not suspended")); return; } @@ -101,12 +101,8 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl else if (area.end_address != null) pc1 = new BigInteger(area.end_address.toString()); } } - if (getStackFrameIndex() != 0) { - if (getStackFrameIndex() < 0) { - // Stepped out of selected function - exit(null); - } - else if (ctx.canResume(IRunControl.RM_STEP_OUT)) { + if (getStackFrameIndex() > 0) { + if (ctx.canResume(IRunControl.RM_STEP_OUT)) { ctx.resume(IRunControl.RM_STEP_OUT, 1, new IRunControl.DoneCommand() { public void doneCommand(IToken token, Exception error) { if (error != null) exit(error); @@ -139,6 +135,7 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl if (error != null) exit(error); } }); + step_cnt++; } else { exit(new Exception("Step over is not supported")); @@ -163,19 +160,21 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl if (pc.compareTo(pc0) < 0 || pc.compareTo(pc1) >= 0) { if (!line_info.validate(this)) return; TCFSourceRef ref = line_info.getData(); - if (ref != null && ref.area != null) { - if (isSameLine(source_ref.area, ref.area)) { - source_ref = ref; - ILineNumbers.CodeArea area = source_ref.area; - if (area.start_address instanceof BigInteger) pc0 = (BigInteger)area.start_address; - else if (area.start_address != null) pc0 = new BigInteger(area.start_address.toString()); - if (area.end_address instanceof BigInteger) pc1 = (BigInteger)area.end_address; - else if (area.end_address != null) pc1 = new BigInteger(area.end_address.toString()); - } - else { - exit(null); - return; - } + if (ref == null || ref.area == null) { + exit(null); + return; + } + else if (isSameLine(source_ref.area, ref.area)) { + source_ref = ref; + ILineNumbers.CodeArea area = source_ref.area; + if (area.start_address instanceof BigInteger) pc0 = (BigInteger)area.start_address; + else if (area.start_address != null) pc0 = new BigInteger(area.start_address.toString()); + if (area.end_address instanceof BigInteger) pc1 = (BigInteger)area.end_address; + else if (area.end_address != null) pc1 = new BigInteger(area.end_address.toString()); + } + else { + exit(null); + return; } } } @@ -200,6 +199,10 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl } protected void exit(Throwable error) { + exit(error, "Step Over"); + } + + protected void exit(Throwable error, String reason) { if (exited) return; if (bp != null) { bps.remove(new String[]{ (String)bp.get(IBreakpoints.PROP_ID) }, new IBreakpoints.DoneCommand() { @@ -209,7 +212,7 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl } rc.removeListener(this); exited = true; - done("Step"); + done(reason); } public void containerResumed(String[] context_ids) { @@ -246,15 +249,20 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl public void contextResumed(String context) { } - public void contextSuspended(String context, String pc, String reason, - Map<String, Object> params) { + public void contextSuspended(String context, String pc, String reason, Map<String, Object> params) { if (!context.equals(ctx.getID())) return; if (IRunControl.REASON_STEP.equals(reason) || isMyBreakpoint(pc, reason)) { Protocol.invokeLater(this); + return; } - else { - exit(null); + if (IRunControl.REASON_BREAKPOINT.equals(reason) && pc0 != null && pc1 != null) { + BigInteger x = new BigInteger(pc); + if (x.compareTo(pc0) >= 0 && x.compareTo(pc1) < 0) { + Protocol.invokeLater(this); + return; + } } + exit(null, reason); } private boolean isSameLine(ILineNumbers.CodeArea x, ILineNumbers.CodeArea y) { diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TCFTestSuite.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TCFTestSuite.java index 786f91044..fdb66b5c0 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TCFTestSuite.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TCFTestSuite.java @@ -235,7 +235,8 @@ public class TCFTestSuite { if (cancel || errors.size() > 0 || pending_tests.size() == 0) { for (IChannel channel : channels) { if (channel != null && channel.getState() != IChannel.STATE_CLOSED) { - channel.close(); + if (errors.size() > 0) channel.terminate(new Exception("Test failed")); + else channel.close(); } } return; |