1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Bug 114793: Add an extension point to contribute command factories. Added the standard command factory for Linux.

This commit is contained in:
Mikhail Khodjaiants 2006-02-07 20:51:02 +00:00
parent 1eff9754a0
commit 667a2e1442
5 changed files with 158 additions and 1 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -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 );
}
}
}
}

View file

@ -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();
}
}

View file

@ -58,7 +58,7 @@
name="%CygWinCommandFactory.name"
platforms="win32"/>
<commandFactory
class="org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory"
class="org.eclipse.cdt.debug.mi.core.command.factories.linux.StandardLinuxCommandFactory"
debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew"
id="org.eclipse.cdt.debug.mi.core.standardLinuxCommandFactory1"
miVersions="mi,mi1,mi2"