Skip to content

Commit

Permalink
Eliminate deprecated GDBBackend methods for CDT 11 (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
jld01 committed Oct 25, 2022
1 parent c1269a9 commit 1590791
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 71 deletions.
35 changes: 18 additions & 17 deletions NewAndNoteworthy/CHANGELOG-API.md
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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).

### <span id="gdbBackendDebuggerCommandLine">Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb</span>

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.
Expand Down Expand Up @@ -492,22 +509,6 @@ See [Bug 563108](https://bugs.eclipse.org/bugs/show_bug.cgi?id=563108).

## API Removals after June 2023

### <span id="gdbBackendDebuggerCommandLine">Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb</span>

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).

### <span id="ManagedCommandLineGenerator.toManagedCommandLineInfo">Add ITool parameter to ManagedCommandLineGenerator.toManagedCommandLineInfo</span>

To allow extenders to know the context of a generated command line, the
Expand Down
@@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -177,12 +178,9 @@ protected IPath getGDBPath() {
/**
* 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.
Expand All @@ -199,47 +197,6 @@ protected String[] getGDBCommandLineArray() {
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();
Expand Down
@@ -1,12 +1,15 @@
/*******************************************************************************
* 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
* which accompanies this distribution, and is available at
* 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;

Expand Down Expand Up @@ -124,15 +127,12 @@ public InputStream getMIErrorStream() {
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;
Expand Down

0 comments on commit 1590791

Please sign in to comment.