From 1590791e76a58ead4d2d7481a5e9a0ff5f83dfab Mon Sep 17 00:00:00 2001 From: John Dallaway Date: Tue, 25 Oct 2022 13:40:13 +0100 Subject: [PATCH] Eliminate deprecated GDBBackend methods for CDT 11 (#112) --- NewAndNoteworthy/CHANGELOG-API.md | 35 ++++++------- .../cdt/dsf/gdb/service/GDBBackend.java | 51 ++----------------- .../cdt/dsf/gdb/service/GDBBackend_7_12.java | 14 ++--- 3 files changed, 29 insertions(+), 71 deletions(-) diff --git a/NewAndNoteworthy/CHANGELOG-API.md b/NewAndNoteworthy/CHANGELOG-API.md index 7dd3b7305fe..afee2e99e1b 100644 --- a/NewAndNoteworthy/CHANGELOG-API.md +++ b/NewAndNoteworthy/CHANGELOG-API.md @@ -12,6 +12,7 @@ This section describes API removals that occurred in past releases, and upcoming - [org.eclipse.cdt.dsf.gdb.breakpoints.Messages is no longer API](#org.eclipse.cdt.dsf.gdb.breakpoints.Messages) - [Removal of deprecated CommandLauncher.execute() method](#executeCommandLauncher) - [Removal of deprecated CBuildConfiguration.watchProcess() methods](#watchProcessCBuildConfig) +- [Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb](#gdbBackendDebuggerCommandLine) ## API Changes in CDT 10.5.0 @@ -49,7 +50,6 @@ See the [policy](../POLICY.md) for the details. ## Planned Removals after June 2023 or on a major version of Eclipe CDT. -- [Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb](#gdbBackendDebuggerCommandLine) - [Add ITool parameter to ManagedCommandLineGenerator.toManagedCommandLineInfo](#ManagedCommandLineGenerator.toManagedCommandLineInfo) - [Removed unneded boolean from function](#GnuMakefileGenerator.addRuleForTool) - [Changed methods from static to non-static](#GnuMakefileGenerator.addDefaultHeader) @@ -133,6 +133,23 @@ in-progress builds of core-build projects: Clients should instead use the methods of the same name that take a progress monitor object. See [Bug 580314](https://bugs.eclipse.org/bugs/show_bug.cgi?id=580314). +### Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb + +To support presentation of the GDB command line within the process +property page, a public method getDebuggerCommandLineArray() has been +added to the org.eclipse.cdt.dsf.gdb.service.IGDBBackend interface and +the following redundant protected methods have been removed: + +- org.eclipse.cdt.dsf.gdb.service.GDBBackend.getDebuggerCommandLine() +- org.eclipse.cdt.dsf.gdb.service.GDBBackend.getGDBCommandLineArray() + +Extenders that previously overrode the above protected methods should override +org.eclipse.cdt.dsf.gdb.service.IGDBBackend.getDebuggerCommandLineArray() +instead. + +See [Bug 572944](https://bugs.eclipse.org/bugs/show_bug.cgi?id=572944) +and https://github.com/eclipse-cdt/cdt/pull/112. + --- ## API Changes in CDT 10.5.0. @@ -492,22 +509,6 @@ See [Bug 563108](https://bugs.eclipse.org/bugs/show_bug.cgi?id=563108). ## API Removals after June 2023 -### Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb - -To support presentation of the GDB command line within the process -property page, a public method getDebuggerCommandLineArray() has been -added to the org.eclipse.cdt.dsf.gdb.service.IGDBBackend interface and -the following redundant protected methods will be removed: - -- org.eclipse.cdt.dsf.gdb.service.GDBBackend.getDebuggerCommandLine() -- org.eclipse.cdt.dsf.gdb.service.GDBBackend.getGDBCommandLineArray() - -Extenders that override the above protected methods should override -org.eclipse.cdt.dsf.gdb.service.IGDBBackend.getDebuggerCommandLineArray() -instead. - -See [Bug 572944](https://bugs.eclipse.org/bugs/show_bug.cgi?id=572944). - ### Add ITool parameter to ManagedCommandLineGenerator.toManagedCommandLineInfo To allow extenders to know the context of a generated command line, the diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java index 344358655fb..3faebeb1a4f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2021 Wind River Systems, Nokia and others. + * Copyright (c) 2006, 2022 Wind River Systems, Nokia and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -16,6 +16,7 @@ * Mark Bozeman (Mentor Graphics) - Report GDB start failures (Bug 376203) * Iulia Vasii (Freescale Semiconductor) - Separate GDB command from its arguments (Bug 445360) * John Dallaway - Implement getDebuggerCommandLineArray() method (Bug 572944) + * John Dallaway - Eliminate deprecated methods (#112) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.service; @@ -177,12 +178,9 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa /** * Options for GDB process. Returns the GDB command and its arguments as an * array. Allow subclass to override. - * - * @since 4.6 - * @deprecated Override {@link #getDebuggerCommandLineArray()} instead */ - @Deprecated(since = "5.2", forRemoval = true) - protected String[] getGDBCommandLineArray() { + @Override + public String[] getDebuggerCommandLineArray() { // The goal here is to keep options to an absolute minimum. // All configuration should be done in the final launch sequence // to allow for more flexibility. @@ -199,47 +197,6 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa return CommandLineUtil.argumentsToArray(cmd); } - @Override - public String[] getDebuggerCommandLineArray() { - // Call the deprecated method which might be overridden - return getDebuggerCommandLine(); - } - - /** - * Returns the GDB command and its arguments as an array. - * Allow subclass to override. - * @since 5.2 - * @deprecated Override {@link #getDebuggerCommandLineArray()} instead - */ - // This method replaces getGDBCommandLineArray() because we need - // to override it for GDB 7.12 even if an extender has overridden - // getGDBCommandLineArray(). - // Here is the scenario: - // An extender has overridden getGDBCommandLineArray() to launch - // GDB in MI mode but with extra parameters. Once GDBBackend_7_12 - // is released, the extender may likely point their extension to - // GDBBackend_7_12 instead of GDBBackend (which will even happen - // automatically if the extender extends GDBBackend_HEAD). - // In such a case, they would override the changes in - // GDBBackend_7_12.getGDBCommandLineArray() and the debug session - // is likely to fail since with GDBBackend_7_12, we launch GDB - // in CLI mode. - // - // Instead, we use getDebuggerCommandLine() and override that method in - // GDBBackend_7_12. That way an extender will not override it - // without noticing (since it didn't exist before). Then we can call - // the overridden getGDBCommandLineArray() and work with that to - // make it work with the new way to launch GDB of GDBBackend_7_12 - // - // Note that we didn't name this method getGDBCommandLine() because - // this name had been used in CDT 8.8 and could still be part of - // extenders' code. - @Deprecated(since = "6.4", forRemoval = true) - protected String[] getDebuggerCommandLine() { - // Call the old method in case it was overridden - return getGDBCommandLineArray(); - } - @Override public String getGDBInitFile() throws CoreException { return getGDBLaunch().getGDBInitFile(); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java index d5652d12def..61946ecbef9 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend_7_12.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2021 Ericsson and others. + * Copyright (c) 2016, 2022 Ericsson and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -7,6 +7,9 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * John Dallaway - Eliminate deprecated method (#112) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.service; @@ -124,15 +127,12 @@ public class GDBBackend_7_12 extends GDBBackend { return fDummyErrorStream; } - /** @deprecated Override {@link #getDebuggerCommandLineArray()} instead */ @Override - @Deprecated(since = "6.4", forRemoval = true) - protected String[] getDebuggerCommandLine() { - // Start from the original command line method which - // could have been overridden by extenders, and add what we need + public String[] getDebuggerCommandLineArray() { + // Start from the original command line method and add what we need // to convert it to a command that will launch in CLI mode. // Then trigger the MI console - String[] originalCommandLine = getGDBCommandLineArray(); + String[] originalCommandLine = super.getDebuggerCommandLineArray(); if (!isFullGdbConsoleSupported()) { return originalCommandLine;