diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java index 16fcb5317fd..44308952aaf 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_4.java @@ -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(getExecutor(), rm)); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java index 64d5612ff6b..3f15f8eee18 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java @@ -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 createMIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) { + return new MIGDBSetPythonPrintStack(ctx, option); + } + /** @since 4.1 */ public ICommand createMIGDBSetSchedulerLocking(ICommandControlDMContext ctx, String mode) { return new MIGDBSetSchedulerLocking(ctx, mode); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java new file mode 100644 index 00000000000..79bf151665e --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPythonPrintStack.java @@ -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$ + } +} \ No newline at end of file