mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 421541 - Support all languages for memory context's address size
add MIGDBShow MIGDBShowLanguage MIGDBSetLanguage When retrieving memory context's address size do Store initial language Set language to c Read address size Restore initial language Change-Id: I6b504526a1cde8d509299d57cf3e1d70d73c4f5b Signed-off-by: Philippe Gil <gil@adacore.com> Reviewed-on: https://git.eclipse.org/r/18371 IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Tested-by: Hudson CI Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
This commit is contained in:
parent
4f485bfd58
commit
1ba8833d49
6 changed files with 294 additions and 40 deletions
|
@ -8,9 +8,11 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Mentor Graphics - Initial API and implementation
|
* Mentor Graphics - Initial API and implementation
|
||||||
* John Dallaway - Add methods to get the endianness and address size (Bug 225609)
|
* John Dallaway - Add methods to get the endianness and address size (Bug 225609)
|
||||||
|
* Philippe Gil (AdaCore) - Switch to c language when getting sizeof(void *) when required (Bug 421541)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.service;
|
package org.eclipse.cdt.dsf.gdb.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -18,6 +20,7 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
@ -35,6 +38,8 @@ import org.eclipse.cdt.dsf.mi.service.MIMemory;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.CLIShowEndianInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.CLIShowEndianInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIDataEvaluateExpressionInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIDataEvaluateExpressionInfo;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowLanguageInfo;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -123,20 +128,55 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeMemoryData(final IMemoryDMContext memContext, RequestMonitor rm) {
|
public void initializeMemoryData(final IMemoryDMContext memContext, RequestMonitor rm) {
|
||||||
|
|
||||||
ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), rm) {
|
ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), rm) {
|
||||||
|
|
||||||
private Step[] fSteps = new Step[] {
|
private String originalLanguage = MIGDBShowLanguageInfo.AUTO;
|
||||||
|
|
||||||
|
// Need a global here as getSteps() can be called more than once.
|
||||||
|
private Step[] steps = null;
|
||||||
|
|
||||||
|
private void determineSteps()
|
||||||
|
{
|
||||||
|
ArrayList<Step> stepsList = new ArrayList<Step>();
|
||||||
|
|
||||||
|
if (fAddressSizes.get(memContext) == null) {
|
||||||
|
stepsList.add(
|
||||||
new Step() {
|
new Step() {
|
||||||
|
// store original language
|
||||||
@Override
|
@Override
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
Integer addrSize = fAddressSizes.get(memContext);
|
fCommandControl.queueCommand(
|
||||||
if (addrSize != null) {
|
fCommandControl.getCommandFactory().createMIGDBShowLanguage(memContext),
|
||||||
|
new ImmediateDataRequestMonitor<MIGDBShowLanguageInfo>(requestMonitor) {
|
||||||
|
@Override
|
||||||
|
@ConfinedToDsfExecutor("fExecutor")
|
||||||
|
protected void handleSuccess() {
|
||||||
|
originalLanguage = getData().getLanguage();
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
stepsList.add(
|
||||||
|
new Step() {
|
||||||
|
// switch to c language
|
||||||
|
@Override
|
||||||
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
|
fCommandControl.queueCommand(
|
||||||
|
fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, MIGDBShowLanguageInfo.C),
|
||||||
|
new ImmediateDataRequestMonitor<MIInfo>(requestMonitor));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
stepsList.add(
|
||||||
|
new Step() {
|
||||||
|
// read address size
|
||||||
|
@Override
|
||||||
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
readAddressSize(
|
readAddressSize(
|
||||||
memContext,
|
memContext,
|
||||||
new DataRequestMonitor<Integer>(ImmediateExecutor.getInstance(), requestMonitor) {
|
new ImmediateDataRequestMonitor<Integer>(requestMonitor) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
@ConfinedToDsfExecutor("fExecutor")
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
|
@ -145,18 +185,30 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
|
|
||||||
|
stepsList.add(
|
||||||
new Step() {
|
new Step() {
|
||||||
|
// restore original language
|
||||||
@Override
|
@Override
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
if ( fIsBigEndian != null) {
|
fCommandControl.queueCommand(
|
||||||
requestMonitor.done();
|
fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, originalLanguage),
|
||||||
return;
|
new ImmediateDataRequestMonitor<MIInfo>(requestMonitor));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fIsBigEndian == null) {
|
||||||
|
stepsList.add(
|
||||||
|
new Step() {
|
||||||
|
// read endianness
|
||||||
|
@Override
|
||||||
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
readEndianness(
|
readEndianness(
|
||||||
memContext,
|
memContext,
|
||||||
new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), requestMonitor) {
|
new ImmediateDataRequestMonitor<Boolean>(requestMonitor) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
@ConfinedToDsfExecutor("fExecutor")
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
|
@ -165,13 +217,19 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
|
}
|
||||||
|
|
||||||
};
|
steps = stepsList.toArray(new Step[stepsList.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Step[] getSteps() {
|
public Step[] getSteps() {
|
||||||
return fSteps;
|
if (steps == null) {
|
||||||
|
determineSteps();
|
||||||
|
}
|
||||||
|
|
||||||
|
return steps;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2012 QNX Software Systems and others.
|
* Copyright (c) 2000, 2013 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
* Vladimir Prus (Mentor Graphics) - Support for -info-os (Bug 360314)
|
* Vladimir Prus (Mentor Graphics) - Support for -info-os (Bug 360314)
|
||||||
* John Dallaway - Support for -data-write-memory-bytes (Bug 387793)
|
* John Dallaway - Support for -data-write-memory-bytes (Bug 387793)
|
||||||
* Alvaro Sanchez-Leon (Ericsson) - Make Registers View specific to a frame (Bug (323552)
|
* Alvaro Sanchez-Leon (Ericsson) - Make Registers View specific to a frame (Bug (323552)
|
||||||
|
* Philippe Gil (AdaCore) - Add show/set language CLI commands (Bug 421541)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.mi.service.command;
|
package org.eclipse.cdt.dsf.mi.service.command;
|
||||||
|
@ -112,6 +113,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetCharset;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetDetachOnFork;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetDetachOnFork;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetEnv;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetEnv;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetHostCharset;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetHostCharset;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetLanguage;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPrintObject;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPrintObject;
|
||||||
|
@ -124,6 +126,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetAsync;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetCharset;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetCharset;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetWideCharset;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetWideCharset;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBShowExitCode;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBShowExitCode;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBShowLanguage;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInferiorTTYSet;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInferiorTTYSet;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInfoOs;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInfoOs;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInterpreterExec;
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInterpreterExec;
|
||||||
|
@ -194,6 +197,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfoOsInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfoOsInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIListFeaturesInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIListFeaturesInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIListThreadGroupsInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIListThreadGroupsInfo;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowLanguageInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackInfoDepthInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackInfoDepthInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListArgumentsInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListArgumentsInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListFramesInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListFramesInfo;
|
||||||
|
@ -698,6 +702,11 @@ public class CommandFactory {
|
||||||
return new MIGDBSetHostCharset(ctx, hostCharset);
|
return new MIGDBSetHostCharset(ctx, hostCharset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 4.3 */
|
||||||
|
public ICommand<MIInfo> createMIGDBSetLanguage(IDMContext ctx, String language) {
|
||||||
|
return new MIGDBSetLanguage(ctx, language);
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand<MIInfo> createMIGDBSetNonStop(ICommandControlDMContext ctx, boolean isSet) {
|
public ICommand<MIInfo> createMIGDBSetNonStop(ICommandControlDMContext ctx, boolean isSet) {
|
||||||
return new MIGDBSetNonStop(ctx, isSet);
|
return new MIGDBSetNonStop(ctx, isSet);
|
||||||
}
|
}
|
||||||
|
@ -752,6 +761,11 @@ public class CommandFactory {
|
||||||
return new MIGDBShowExitCode(ctx);
|
return new MIGDBShowExitCode(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 4.3 */
|
||||||
|
public ICommand<MIGDBShowLanguageInfo> createMIGDBShowLanguage(IDMContext ctx) {
|
||||||
|
return new MIGDBShowLanguage(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
/** @since 4.0 */
|
/** @since 4.0 */
|
||||||
public ICommand<MIInfo> createMIInferiorTTYSet(IMIContainerDMContext dmc, String tty) {
|
public ICommand<MIInfo> createMIInferiorTTYSet(IMIContainerDMContext dmc, String tty) {
|
||||||
return new MIInferiorTTYSet(dmc, tty);
|
return new MIInferiorTTYSet(dmc, tty);
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 AdaCore and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Philippe Gil (AdaCore) - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* -gdb-set language
|
||||||
|
*
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public class MIGDBSetLanguage extends MIGDBSet {
|
||||||
|
|
||||||
|
public MIGDBSetLanguage(IDMContext ctx, String language) {
|
||||||
|
super(ctx, new String[] {"language", language}); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 AdaCore and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Philippe Gil (AdaCore) - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* -gdb-show
|
||||||
|
*
|
||||||
|
* @since 4.3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MIGDBShow<V extends MIInfo> extends MICommand<V>
|
||||||
|
{
|
||||||
|
public MIGDBShow(IDMContext ctx, String[] params) {
|
||||||
|
super(ctx, "-gdb-show", null, params); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 AdaCore and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Philippe Gil (AdaCore) - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowLanguageInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* -gdb-show language
|
||||||
|
*
|
||||||
|
* @since 4.3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MIGDBShowLanguage extends MIGDBShow<MIGDBShowLanguageInfo>
|
||||||
|
{
|
||||||
|
public MIGDBShowLanguage(IDMContext ctx) {
|
||||||
|
super(ctx, new String[] {"language"}); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MIGDBShowLanguageInfo getResult(MIOutput miResult) {
|
||||||
|
return new MIGDBShowLanguageInfo(miResult);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 AdaCore and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Philippe Gil (AdaCore) - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* '-gdb-show language' returns the current source language.
|
||||||
|
*
|
||||||
|
* sample output:
|
||||||
|
*
|
||||||
|
* -gdb-show language
|
||||||
|
* ^done,value="auto"
|
||||||
|
*
|
||||||
|
* the different returned values are:
|
||||||
|
*
|
||||||
|
* (gdb) help set language
|
||||||
|
* Set the current source language.
|
||||||
|
* The currently understood settings are:
|
||||||
|
*
|
||||||
|
* local or auto Automatic setting based on source file
|
||||||
|
* ada Use the Ada language
|
||||||
|
* c Use the C language
|
||||||
|
* c++ Use the C++ language
|
||||||
|
* asm Use the Asm language
|
||||||
|
* minimal Use the Minimal language
|
||||||
|
* d Use the D language
|
||||||
|
* fortran Use the Fortran language
|
||||||
|
* objective-c Use the Objective-c language
|
||||||
|
* go Use the Go language
|
||||||
|
* java Use the Java language
|
||||||
|
* modula-2 Use the Modula-2 language
|
||||||
|
* opencl Use the Opencl language
|
||||||
|
* pascal Use the Pascal language
|
||||||
|
*
|
||||||
|
* @since 4.3
|
||||||
|
*/
|
||||||
|
public class MIGDBShowLanguageInfo extends MIInfo {
|
||||||
|
|
||||||
|
public static final String LOCAL = "local"; //$NON-NLS-1$
|
||||||
|
public static final String AUTO = "auto"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final String ADA = "ada"; //$NON-NLS-1$
|
||||||
|
public static final String C = "c"; //$NON-NLS-1$
|
||||||
|
public static final String C_PLUS_PLUS = "c++"; //$NON-NLS-1$
|
||||||
|
public static final String ASM = "asm"; //$NON-NLS-1$
|
||||||
|
public static final String MINIMAL = "minimal"; //$NON-NLS-1$
|
||||||
|
public static final String D = "d"; //$NON-NLS-1$
|
||||||
|
public static final String FORTRAN = "fortran"; //$NON-NLS-1$
|
||||||
|
public static final String OBJECTIVE_C = "objective-c"; //$NON-NLS-1$
|
||||||
|
public static final String GO = "go"; //$NON-NLS-1$
|
||||||
|
public static final String JAVA = "java"; //$NON-NLS-1$
|
||||||
|
public static final String MODULA_2 = "modula-2"; //$NON-NLS-1$
|
||||||
|
public static final String OPENCL = "opencl"; //$NON-NLS-1$
|
||||||
|
public static final String PASCAL = "pascal"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private String fLanguage = AUTO;
|
||||||
|
|
||||||
|
public MIGDBShowLanguageInfo(MIOutput record) {
|
||||||
|
super(record);
|
||||||
|
parse();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void parse() {
|
||||||
|
if (isDone()) {
|
||||||
|
MIOutput out = getMIOutput();
|
||||||
|
MIResultRecord outr = out.getMIResultRecord();
|
||||||
|
if (outr != null) {
|
||||||
|
MIResult[] results = outr.getMIResults();
|
||||||
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
String var = results[i].getVariable();
|
||||||
|
if (var.equals("value")) { //$NON-NLS-1$
|
||||||
|
MIValue value = results[i].getMIValue();
|
||||||
|
if (value instanceof MIConst) {
|
||||||
|
fLanguage = ((MIConst)value).getString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return fLanguage;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue