1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

[lldb] Remove work-around for missing '-gdb-set breakpoint pending'

For more recent versions fo LLDB (8.0.0-r345563) this work-around is not required.
This is a follow-up to bug 539641.
See also https://reviews.llvm.org/D52953

Change-Id: If5f951a33fab8781a594175571d0ad5131e9ef15
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
This commit is contained in:
Marc-Andre Laperle 2018-10-29 23:51:20 -04:00 committed by Marc-André Laperle
parent b33ebe2ee6
commit c278f4575f
4 changed files with 41 additions and 10 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017 Ericsson.
* Copyright (c) 2017 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
@ -34,7 +34,13 @@ public enum LLDBTrait {
* Inserting a breakpoint with full path would not work.
* TODO: Remove for versions < 4.0.0 eventually
*/
BROKEN_BREAKPOINT_INSERT_FULL_PATH_LLVM_BUG_28709;
BROKEN_BREAKPOINT_INSERT_FULL_PATH_LLVM_BUG_28709,
/**
* Trait for LLDBs that do not have "-gdb-set breakpoint pending"
* implemented. It was added in LLDB 8.0 as of r345563.
* See https://reviews.llvm.org/D52953
*/
MISSING_GDB_SET_BREAKPOINT_PENDING;
/**
* Returns whether or not the given session has this trait.

View file

@ -232,6 +232,10 @@ public class LLDBLaunch extends GdbLaunch {
if (fLldbVersion != null && fLldbVersion.compareTo(new IntegerTuple(4, 0, 0)) < 0 || fLldbRevision != null && fLldbRevision.compareTo(new IntegerTuple(370, 0, 37)) < 0) {
fTraits.add(LLDBTrait.BROKEN_BREAKPOINT_INSERT_FULL_PATH_LLVM_BUG_28709);
}
if (fLldbVersion != null && fLldbVersion.compareTo(new IntegerTuple(8, 0, 0)) < 0 || fLldbRevision != null) {
fTraits.add(LLDBTrait.MISSING_GDB_SET_BREAKPOINT_PENDING);
}
}
}

View file

@ -36,7 +36,7 @@ public class LLDBServiceFactory extends GdbDebugServicesFactory {
@Override
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
return new LLDBControl(session, config, new LLDBCommandFactory());
return new LLDBControl(session, config, new LLDBCommandFactory(session));
}
@Override

View file

@ -15,6 +15,8 @@ import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.llvm.dsf.lldb.core.internal.LLDBTrait;
/**
* A command factory specific to LLDB for cases where some commands need any
@ -22,6 +24,17 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
*/
public class LLDBCommandFactory extends CommandFactory {
private DsfSession fSession;
/**
* Construct a command factory specific to LLDB.
*
* @param session the debugging session
*/
public LLDBCommandFactory(DsfSession session) {
fSession = session;
}
/**
* lldb-mi (as of 8.0.0-r341271) doesn't implement "-gdb-set args" but it does
* implement "-exec-arguments". So we just substitute here.
@ -41,15 +54,17 @@ public class LLDBCommandFactory extends CommandFactory {
}
/**
* lldb-mi (as of 8.0.0-r343825) doesn't implement "-gdb-set breakpoint pending"
* so instead we always use "-break-insert -f" to always use pending breakpoints.
* Once the -gdb-set is implemented in lldb-mi, we can remove this.
* See also https://reviews.llvm.org/D52953
* lldb-mi implements "-gdb-set breakpoint pending" starting with 8.0.0-r345563.
* For earlier version we use "-break-insert -f" to always use pending
* breakpoints. See also https://reviews.llvm.org/D52953
*/
@Override
public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
boolean isHardware, String condition, int ignoreCount, String line, String tid) {
return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, true);
if (LLDBTrait.MISSING_GDB_SET_BREAKPOINT_PENDING.isTraitOf(fSession)) {
return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, true);
}
return super.createMIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid);
}
/**
@ -59,7 +74,10 @@ public class LLDBCommandFactory extends CommandFactory {
public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary,
boolean isHardware, String condition, int ignoreCount, String location, String tid, boolean disabled,
boolean isTracepoint) {
return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint, true);
if (LLDBTrait.MISSING_GDB_SET_BREAKPOINT_PENDING.isTraitOf(fSession)) {
return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint, true);
}
return super.createMIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint);
}
/**
@ -67,6 +85,9 @@ public class LLDBCommandFactory extends CommandFactory {
*/
@Override
public ICommand<MIBreakInsertInfo> createMIBreakInsert(IBreakpointsTargetDMContext ctx, String func) {
return new MIBreakInsert(ctx, func, true);
if (LLDBTrait.MISSING_GDB_SET_BREAKPOINT_PENDING.isTraitOf(fSession)) {
return new MIBreakInsert(ctx, func, true);
}
return super.createMIBreakInsert(ctx, func);
}
}