diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index f35bf3755bd..c36102541d8 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,11 @@ +2006-02-07 Mikhail Khodjaiants + Bug 114793: Add an extension point to contribute command factories. + + mi/org/eclipse/cdt/debug/mi/core/command/factories/linux (package) + + LinuxCLIInfoSharedLibrary.java + + LinuxCLIInfoSharedLibraryInfo.java + + StandardLinuxCommandFactory.java + * plugin.xml + 2006-02-07 Mikhail Khodjaiants Bug 126789: Use new "fullname" attribute of stack frame description. * MIStackListFrames.java diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibrary.java new file mode 100644 index 00000000000..386afa56693 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibrary.java @@ -0,0 +1,37 @@ +/********************************************************************** + * Copyright (c) 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.debug.mi.core.command.factories.linux; + +import org.eclipse.cdt.debug.mi.core.MIException; +import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; +import org.eclipse.cdt.debug.mi.core.output.MIInfo; +import org.eclipse.cdt.debug.mi.core.output.MIOutput; + +/** + * Linux version of "info shared library". + */ +public class LinuxCLIInfoSharedLibrary extends CLIInfoSharedLibrary { + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary#getMIInfo() + */ + public MIInfo getMIInfo() throws MIException { + MIInfo info = null; + MIOutput out = getMIOutput(); + if ( out != null ) { + info = new LinuxCLIInfoSharedLibraryInfo( out ); + if ( info.isError() ) { + throwMIException( info, out ); + } + } + return info; + } +} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibraryInfo.java new file mode 100644 index 00000000000..1e9f63c56b4 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/LinuxCLIInfoSharedLibraryInfo.java @@ -0,0 +1,71 @@ +/********************************************************************** + * Copyright (c) 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.debug.mi.core.command.factories.linux; + +import java.util.List; +import org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo; +import org.eclipse.cdt.debug.mi.core.output.MIOutput; +import org.eclipse.cdt.debug.mi.core.output.MIShared; + +/** + * Linux specific parser of the "info shared" output. + */ +public class LinuxCLIInfoSharedLibraryInfo extends CLIInfoSharedLibraryInfo { + + /** + * Constructor for LinuxCLIInfoSharedLibraryInfo. + */ + public LinuxCLIInfoSharedLibraryInfo( MIOutput out ) { + super( out ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo#parseShared(java.lang.String, java.util.List) + */ + protected void parseShared( String str, List aList ) { + if ( str.length() > 0 && !str.startsWith( "From" ) ) { //$NON-NLS-1$ + // Pass the header + int index = -1; + String from = ""; //$NON-NLS-1$ + String to = ""; //$NON-NLS-1$ + boolean syms = false; + String name = ""; //$NON-NLS-1$ + for( int i = 0; (index = str.lastIndexOf( ' ' )) != -1 || i <= 3; i++ ) { + if ( index == -1 ) { + index = 0; + } + String sub = str.substring( index ).trim(); + // move to previous column + str = str.substring( 0, index ).trim(); + switch( i ) { + case 0: + name = sub; + break; + case 1: + if ( sub.equalsIgnoreCase( "Yes" ) ) { //$NON-NLS-1$ + syms = true; + } + break; + case 2: // second column is "To" + to = sub; + break; + case 3: // first column is "From" + from = sub; + break; + } + } + if ( name.length() > 0 ) { + MIShared s = new MIShared( from, to, syms, name ); + aList.add( s ); + } + } + } +} diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/StandardLinuxCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/StandardLinuxCommandFactory.java new file mode 100644 index 00000000000..099e7b0bd52 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/linux/StandardLinuxCommandFactory.java @@ -0,0 +1,41 @@ +/********************************************************************** + * Copyright (c) 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.debug.mi.core.command.factories.linux; + +import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; +import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory; + +/** + * Command factory for the standard gdb/mi protocol for Linux. + */ +public class StandardLinuxCommandFactory extends StandardCommandFactory { + + /** + * Constructor for StandardLinuxCommandFactory. + */ + public StandardLinuxCommandFactory() { + super(); + } + + /** + * Constructor for StandardLinuxCommandFactory. + */ + public StandardLinuxCommandFactory( String miVersion ) { + super( miVersion ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createCLIInfoSharedLibrary() + */ + public CLIInfoSharedLibrary createCLIInfoSharedLibrary() { + return new LinuxCLIInfoSharedLibrary(); + } +} diff --git a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml b/debug/org.eclipse.cdt.debug.mi.core/plugin.xml index 469ebddde32..173a7cf3aa3 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.mi.core/plugin.xml @@ -58,7 +58,7 @@ name="%CygWinCommandFactory.name" platforms="win32"/>