From dbfda6695ede58757afe3171cc6921bffd1d1ce5 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Tue, 30 Sep 2003 01:59:10 +0000 Subject: [PATCH] Added the initialization of the shared libraries' attributes to CygwinGDBDebugger. --- debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 9 ++++-- .../cdt/debug/mi/core/CygwinGDBDebugger.java | 29 ++++++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index ab6e8fce23a..b5848d5f28c 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,8 @@ +2003-09-29 Mikhail Khodjaiants + Added the initialization of the shared libraries' attributes to CygwinGDBDebugger. + + * src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java + 2003-09-26 Alain Magloire Second part of PR 43496. @@ -14,7 +19,7 @@ * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java -2003-11-10 Mikhail Khodjaiants +2003-09-11 Mikhail Khodjaiants Moving the shared library search paths block to mi UI. * IMILaunchConfigurationConstants.java: added the 'ATTR_DEBUGGER_SOLIB_PATH' attribute. @@ -30,7 +35,7 @@ 2003-09-09 Mikhail Khodjaiants Added the 'stop-on-solib-events' option. - Changed the initialization of the hared library search path. + Changed the initialization of the shared library search path. Changed the messages of the thrown exceptions. * GDBDebugger.java diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java index 98bca61d10f..19cacfa0f46 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java @@ -5,14 +5,20 @@ package org.eclipse.cdt.debug.mi.core; +import java.util.Collections; +import java.util.List; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDISession; +import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager; import org.eclipse.cdt.debug.mi.core.cdi.Session; +import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; import org.eclipse.cdt.debug.mi.core.command.CommandFactory; import org.eclipse.cdt.debug.mi.core.command.CygwinCommandFactory; import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.debug.core.ILaunchConfiguration; @@ -25,8 +31,29 @@ public class CygwinGDBDebugger extends GDBDebugger { static final CygwinCommandFactory commandFactory = new CygwinCommandFactory(); - /* Cygwin does not have any special initialization like solib paths etc.. */ protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException { + try { + ICDISharedLibraryManager mgr = session.getSharedLibraryManager(); + if (mgr instanceof SharedLibraryManager) { + boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false); + try { + ((SharedLibraryManager)mgr).setStopOnSolibEvents(stopOnSolibEvents); + } catch (CDIException e) { + // Ignore this error + // it seems to be a real problem on many gdb platform + } + } + List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST); + if (p.size() > 0) { + String[] oldPaths = mgr.getSharedLibraryPaths(); + String[] paths = new String[oldPaths.length + p.size()]; + System.arraycopy((String[])p.toArray(new String[p.size()]), 0, paths, 0, p.size()); + System.arraycopy(oldPaths, 0, paths, p.size(), oldPaths.length); + mgr.setSharedLibraryPaths(paths); + } + } catch (CoreException e) { + throw new CDIException("Error initializing shared library options: " + e.getMessage()); + } } public ICDISession createLaunchSession(