diff options
author | Mikhail Khodjaiants | 2006-02-07 20:51:02 +0000 |
---|---|---|
committer | Mikhail Khodjaiants | 2006-02-07 20:51:02 +0000 |
commit | 667a2e1442131542a69ea426334804d8864d57fa (patch) | |
tree | 01307e1bd464464f8d45ef5dcbe8cd993ef0e18a /debug/org.eclipse.cdt.debug.mi.core/mi | |
parent | 1eff9754a0a890818cd4d7600e4dfd03ef28feeb (diff) | |
download | org.eclipse.cdt-667a2e1442131542a69ea426334804d8864d57fa.tar.gz org.eclipse.cdt-667a2e1442131542a69ea426334804d8864d57fa.tar.xz org.eclipse.cdt-667a2e1442131542a69ea426334804d8864d57fa.zip |
Bug 114793: Add an extension point to contribute command factories. Added the standard command factory for Linux.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.mi.core/mi')
3 files changed, 149 insertions, 0 deletions
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(); + } +} |