1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

2005-06-27 Alain Magloire

New command from newer version of gdb "set breakpoint pending"
	better handling of the breakpoint while the target is running.
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
	* mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
	+ mi/org/eclipse/cdt/debug/mi/core/ccommand/MIGDBSetBreakpoinPending.java
This commit is contained in:
Alain Magloire 2005-06-28 16:57:33 +00:00
parent 03cb2a3ec9
commit 52a370c3ae
6 changed files with 96 additions and 6 deletions

View file

@ -1,3 +1,13 @@
2005-06-27 Alain Magloire
New command from newer version of gdb "set breakpoint pending"
better handling of the breakpoint while the target is running.
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
* mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
+ mi/org/eclipse/cdt/debug/mi/core/ccommand/MIGDBSetBreakpoinPending.java
2005-06-27 Alain Magloire
Bug when parsing "int *&" corrected.
Change in ICDIReferenceValue.

View file

@ -52,6 +52,7 @@ import org.eclipse.cdt.debug.mi.core.command.MIBreakEnable;
import org.eclipse.cdt.debug.mi.core.command.MIBreakInsert;
import org.eclipse.cdt.debug.mi.core.command.MIBreakList;
import org.eclipse.cdt.debug.mi.core.command.MIBreakWatch;
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetBreakpointPending;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent;
@ -153,9 +154,9 @@ public class BreakpointManager extends Manager {
void resumeInferior(Target target, boolean shouldRestart) throws CDIException {
if (shouldRestart) {
target.resume();
// Enable events again.
((EventManager)getSession().getEventManager()).allowProcessingEvents(true);
target.resume();
}
}
@ -865,6 +866,27 @@ public class BreakpointManager extends Manager {
return excp;
}
/**
* Call -gdb-set breakpoint pending set
* @param target
* @param set
* @throws CDIException
*/
public void setBreakpointPending(Target target, boolean set) throws CDIException {
MISession miSession = target.getMISession();
CommandFactory factory = miSession.getCommandFactory();
MIGDBSetBreakpointPending bpp = factory.createMIGDBSetBreakpointPending(set);
try {
miSession.postCommand(bpp);
MIInfo info = bpp.getMIInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
} catch (MIException e) {
throw new MI2CDIException(e);
}
}
public Condition createCondition(int ignoreCount, String expression, String[] tids) {
return new Condition(ignoreCount, expression, tids);
}

View file

@ -87,11 +87,6 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
*/
public void update(Observable o, Object arg) {
// Bailout early if we do not want to process any events.
if (!isAllowingProcessingEvents()) {
return;
}
MIEvent miEvent = (MIEvent)arg;
Session session = (Session)getSession();
Target currentTarget = session.getTarget(miEvent.getMISession());
@ -265,6 +260,14 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
Session session = (Session)getSession();
MISession miSession = stopped.getMISession();
Target currentTarget = session.getTarget(miSession);
currentTarget.setSupended(true);
// Bailout early if we do not want to process any events.
if (!isAllowingProcessingEvents()) {
return false;
}
if (processSharedLibEvent(stopped)) {
// Event was consumed by the shared lib processing bailout
return false;
@ -506,6 +509,17 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
*/
boolean processRunningEvent(MIRunningEvent running) {
lastRunningEvent = running;
Session session = (Session)getSession();
MISession miSession = running.getMISession();
Target currentTarget = session.getTarget(miSession);
currentTarget.setSupended(false);
// Bailout early if we do not want to process any events.
if (!isAllowingProcessingEvents()) {
return false;
}
return true;
}

View file

@ -90,6 +90,7 @@ public class Target extends SessionObject implements ICDITarget {
Thread[] currentThreads;
int currentThreadId;
String fEndian = null;
boolean suspended = true;
public Target(Session s, MISession mi) {
super(s);
@ -130,6 +131,11 @@ public class Target extends SessionObject implements ICDITarget {
}
}
public synchronized void setSupended(boolean state) {
suspended = state;
notifyAll();
}
/**
*/
public void setCurrentThread(Thread cthread, boolean doUpdate) throws CDIException {
@ -545,6 +551,15 @@ public class Target extends SessionObject implements ICDITarget {
public void suspend() throws CDIException {
try {
miSession.getMIInferior().interrupt();
// Wait till the EventManager tell us the go ahead
synchronized (this) {
for (int i = 0; !suspended && i < 6; i++) {
try {
wait(1000);
} catch (InterruptedException e) {
}
}
}
} catch (MIException e) {
throw new MI2CDIException(e);
}

View file

@ -220,6 +220,10 @@ public class CommandFactory {
return new MIGDBSetSolibSearchPath(getMIVersion(), params);
}
public MIGDBSetBreakpointPending createMIGDBSetBreakpointPending(boolean set) {
return new MIGDBSetBreakpointPending(getMIVersion(), set);
}
public MIGDBShow createMIGDBShow(String[] params) {
return new MIGDBShow(getMIVersion(), params);
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2005 QnX Software Systems 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:
* Qnx Software Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* MIGDBSetBreakpointPending
*
*/
public class MIGDBSetBreakpointPending extends MIGDBSet {
public MIGDBSetBreakpointPending(String miVersion, boolean set) {
super(miVersion, new String[] {"breakpoint", "pending", (set) ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}