1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 367788: Use the new 'set python print-stack' command.

This commit is contained in:
Marc Khouzam 2012-01-05 22:24:22 -05:00
parent 63546f3ccf
commit f6d3c6295b
3 changed files with 52 additions and 10 deletions

View file

@ -10,30 +10,31 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service.command;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.debug.core.ILaunchConfiguration;
/**
* With GDB 7.4, the command 'maintenance set python print-stack' is not supported.
* The new command "set python print-stack none|full|message" has replaced it, with
* the default being 'message'. With this new default
* The new command "set python print-stack none|full|message" has replaced it.
* @since 4.1
*/
public class GDBControl_7_4 extends GDBControl_7_2 implements IGDBControl {
public GDBControl_7_4(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
super(session, config, factory);
setUseThreadGroupOptions(true);
}
@Override
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
// With GDB 7.4, the command 'maintenance set python print-stack' is not supported.
// The new command "set python print-stack none|full|message" has replaced it, with
// the default being 'message'. This new default is good enough for us, so no
// need to do anything anymore.
// Bug 367788
rm.done();
// With GDB 7.4, the command 'maintenance set python print-stack' has been replaced by
// the new command "set python print-stack none|full|message".
// Bug 367788
String errorOption = enabled ? "full" : "none"; //$NON-NLS-1$ //$NON-NLS-2$
queueCommand(
getCommandFactory().createMIGDBSetPythonPrintStack(getContext(), errorOption),
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2011 QNX Software Systems and others.
* Copyright (c) 2000, 2012 QNX Software Systems 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
@ -15,6 +15,7 @@
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
* Abeer Bagul - Support for -exec-arguments (bug 337687)
* Marc Khouzam (Ericsson) - New methods for new MIDataDisassemble (Bug 357073)
* Marc Khouzam (Ericsson) - New method for new MIGDBSetPythonPrintStack (Bug 367788)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command;
@ -101,6 +102,7 @@ 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.MIGDBSetNonStop;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPythonPrintStack;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSchedulerLocking;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibAbsolutePrefix;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath;
@ -631,6 +633,11 @@ public class CommandFactory {
return new MIGDBSetPagination(ctx, isSet);
}
/** @since 4.1 */
public ICommand<MIInfo> createMIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) {
return new MIGDBSetPythonPrintStack(ctx, option);
}
/** @since 4.1 */
public ICommand<MIInfo> createMIGDBSetSchedulerLocking(ICommandControlDMContext ctx, String mode) {
return new MIGDBSetSchedulerLocking(ctx, mode);

View file

@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson 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:
* Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/**
*
* -gdb-set python print-stack [ none | message | full ]
*
* By default, gdb will print only the message component of a Python exception when an error occurs
* in a Python script. This can be controlled using set python print-stack: if full, then full Python
* stack printing is enabled; if none, then Python stack and message printing is disabled; if message,
* the default, only the message component of the error is printed.
*
* Available with GDB 7.4
*
* @since 4.1
*
*/
public class MIGDBSetPythonPrintStack extends MIGDBSet
{
public MIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) {
super(ctx, new String[] {"python", "print-stack", option}); //$NON-NLS-1$//$NON-NLS-2$
}
}