1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 248587: Support "Event' Breakpoints (backed out unused API changes)

This commit is contained in:
John Cortell 2010-05-17 21:02:54 +00:00
parent f2fab88813
commit 0316c02daa
3 changed files with 11 additions and 37 deletions

View file

@ -131,7 +131,7 @@ public class MIRunControlEventProcessor
if (var.equals("reason")) { //$NON-NLS-1$ if (var.equals("reason")) { //$NON-NLS-1$
if (val instanceof MIConst) { if (val instanceof MIConst) {
String reason = ((MIConst) val).getString(); String reason = ((MIConst) val).getString();
MIEvent<?> e = createEvent(reason, exec, ((MIOutput)output).getStreamRecords()); MIEvent<?> e = createEvent(reason, exec);
if (e != null) { if (e != null) {
events.add(e); events.add(e);
continue; continue;
@ -158,7 +158,7 @@ public class MIRunControlEventProcessor
// GDB for temporary breakpoints will not send the // GDB for temporary breakpoints will not send the
// "reason" ??? still fire a stopped event. // "reason" ??? still fire a stopped event.
if (events.isEmpty()) { if (events.isEmpty()) {
MIEvent<?> e = createEvent(STOPPED_REASON, exec, ((MIOutput)output).getStreamRecords()); MIEvent<?> e = createEvent(STOPPED_REASON, exec);
if (e != null) { if (e != null) {
events.add(e); events.add(e);
} }
@ -249,22 +249,12 @@ public class MIRunControlEventProcessor
return execDmc; return execDmc;
} }
/**
* @param miStreamRecords
* the stream records that preceded 'exec'. Determining which
* type of event to create may require additional insight
* available in those records. One example is catchpoint hits.
* They are reported by gdb (>= 7.0)as a simple breakpoint hit.
* However, gdb also sends a stream record that reveals that it's
* a catchpoint hit.
* @since 3.0
*/
@ConfinedToDsfExecutor("") @ConfinedToDsfExecutor("")
protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec, MIStreamRecord[] miStreamRecords) { protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
IExecutionDMContext execDmc = getExecutionContext(exec); IExecutionDMContext execDmc = getExecutionContext(exec);
MIEvent<?> event = null; MIEvent<?> event = null;
if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$ if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$
event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults(), miStreamRecords); event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
} else if ( } else if (
"watchpoint-trigger".equals(reason) //$NON-NLS-1$ "watchpoint-trigger".equals(reason) //$NON-NLS-1$
|| "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$ || "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$

View file

@ -21,11 +21,11 @@ import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandListener; import org.eclipse.cdt.dsf.debug.service.command.ICommandListener;
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult; import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
import org.eclipse.cdt.dsf.debug.service.command.ICommandToken; import org.eclipse.cdt.dsf.debug.service.command.ICommandToken;
import org.eclipse.cdt.dsf.debug.service.command.IEventListener; import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
import org.eclipse.cdt.dsf.mi.service.MIProcesses; import org.eclipse.cdt.dsf.mi.service.MIProcesses;
@ -61,7 +61,6 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOOBRecord;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput; import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MIResult; import org.eclipse.cdt.dsf.mi.service.command.output.MIResult;
import org.eclipse.cdt.dsf.mi.service.command.output.MIResultRecord; import org.eclipse.cdt.dsf.mi.service.command.output.MIResultRecord;
import org.eclipse.cdt.dsf.mi.service.command.output.MIStreamRecord;
import org.eclipse.cdt.dsf.mi.service.command.output.MIValue; import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfServicesTracker;
@ -134,7 +133,7 @@ public class MIRunControlEventProcessor_7_0
if (var.equals("reason")) { //$NON-NLS-1$ if (var.equals("reason")) { //$NON-NLS-1$
if (val instanceof MIConst) { if (val instanceof MIConst) {
String reason = ((MIConst) val).getString(); String reason = ((MIConst) val).getString();
MIEvent<?> e = createEvent(reason, exec, ((MIOutput)output).getStreamRecords()); MIEvent<?> e = createEvent(reason, exec);
if (e != null) { if (e != null) {
events.add(e); events.add(e);
continue; continue;
@ -146,7 +145,7 @@ public class MIRunControlEventProcessor_7_0
// GDB for temporary breakpoints will not send the // GDB for temporary breakpoints will not send the
// "reason" ??? still fire a stopped event. // "reason" ??? still fire a stopped event.
if (events.isEmpty()) { if (events.isEmpty()) {
MIEvent<?> e = createEvent(STOPPED_REASON, exec, ((MIOutput)output).getStreamRecords()); MIEvent<?> e = createEvent(STOPPED_REASON, exec);
if (e != null) { if (e != null) {
events.add(e); events.add(e);
} }
@ -157,7 +156,7 @@ public class MIRunControlEventProcessor_7_0
} }
} }
else if (RUNNING_REASON.equals(state)) { else if (RUNNING_REASON.equals(state)) {
MIEvent<?> event = createEvent(RUNNING_REASON, exec, ((MIOutput)output).getStreamRecords()); MIEvent<?> event = createEvent(RUNNING_REASON, exec);
if (event != null) { if (event != null) {
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
} }
@ -246,18 +245,8 @@ public class MIRunControlEventProcessor_7_0
} }
} }
/**
* @since 3.0
* @param miStreamRecords
* the stream records that preceded 'exec'. Determining which
* type of event to create may require additional insight
* available in those records. One example is catchpoint hits.
* They are reported by gdb (>= 7.0)as a simple breakpoint hit.
* However, gdb also sends a stream record that reveals that it's
* a catchpoint hit.
*/
@ConfinedToDsfExecutor("") @ConfinedToDsfExecutor("")
protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec, MIStreamRecord[] miStreamRecords) { protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
MIEvent<?> event = null; MIEvent<?> event = null;
if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$ if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$
@ -321,7 +310,7 @@ public class MIRunControlEventProcessor_7_0
} }
if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$ if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$
event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults(), miStreamRecords); event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
} else if ( } else if (
"watchpoint-trigger".equals(reason) //$NON-NLS-1$ "watchpoint-trigger".equals(reason) //$NON-NLS-1$
|| "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$ || "read-watchpoint-trigger".equals(reason) //$NON-NLS-1$

View file

@ -25,7 +25,6 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.mi.service.command.output.MIConst; import org.eclipse.cdt.dsf.mi.service.command.output.MIConst;
import org.eclipse.cdt.dsf.mi.service.command.output.MIFrame; import org.eclipse.cdt.dsf.mi.service.command.output.MIFrame;
import org.eclipse.cdt.dsf.mi.service.command.output.MIResult; import org.eclipse.cdt.dsf.mi.service.command.output.MIResult;
import org.eclipse.cdt.dsf.mi.service.command.output.MIStreamRecord;
import org.eclipse.cdt.dsf.mi.service.command.output.MIValue; import org.eclipse.cdt.dsf.mi.service.command.output.MIValue;
import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints; import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints;
@ -55,12 +54,8 @@ public class MIBreakpointHitEvent extends MIStoppedEvent {
return bkptno; return bkptno;
} }
/**
* @param miStreamRecords
* @since 3.0
*/
@ConfinedToDsfExecutor("") @ConfinedToDsfExecutor("")
public static MIBreakpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, MIStreamRecord[] miStreamRecords) { public static MIBreakpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) {
int bkptno = -1; int bkptno = -1;
for (int i = 0; i < results.length; i++) { for (int i = 0; i < results.length; i++) {