Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366532

Summary: SharedLibraryManager exception during tear-down
Product: [Tools] CDT Reporter: Andrey Loskutov <loskutov>
Component: cdt-debugAssignee: cdt-debug-inbox <cdt-debug-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: cdtdoug, pawel.1.piech
Version: 8.1.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Andrey Loskutov CLA 2011-12-13 08:52:35 EST
Build Identifier: 3.7.1 / CDT 8.0.1

We've got this each time our process we debugging right now with CDT is stopped via IDebugTarget.terminate() (there will be an MIStoppedEvent):

org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException: Inferior terminated[]
	at org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager.getMIShareds(SharedLibraryManager.java:123)
	at org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager.updateState(SharedLibraryManager.java:188)
	at org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager.update(SharedLibraryManager.java:136)
	at org.eclipse.cdt.debug.mi.core.cdi.EventManager.processSuspendedEvent(EventManager.java:326)
	at org.eclipse.cdt.debug.mi.core.cdi.EventManager.update(EventManager.java:100)
	at java.util.Observable.notifyObservers(Observable.java:142)
	at org.eclipse.cdt.debug.mi.core.MISession.notifyObservers(MISession.java:791)
	at org.eclipse.cdt.debug.mi.core.EventThread.run(EventThread.java:46)

Reproducible: Always

Steps to Reproduce:
Start a process in CDT debugger, stop it from the code via IDebugTarget.terminate(). You will get an error in the log.

I can fix the issue by adding the if() block below just after the beginning of getMIShareds() method:

MIShared[] getMIShareds(MISession miSession) throws CDIException {
    MIShared[] miLibs = new MIShared[0];
		
    if (miSession.isTerminated() || (miSession.getMIInferior() == null  || miSession.getMIInferior().isTerminated())) {
        return miLibs;
    }