|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2004, 2012 QNX Software Systems and others. |
| 2 | + * Copyright (c) 2004, 2025 QNX Software Systems and others. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials |
5 | 5 | * are made available under the terms of the Eclipse Public License 2.0 |
|
12 | 12 | * QNX Software Systems - Initial API and implementation |
13 | 13 | * Ken Ryall (Nokia) - Support for breakpoint actions (bug 118308) |
14 | 14 | * Sergey Prigogin (Google) |
| 15 | + * John Dallaway - Prefer LLDB local debug delegates on macOS AArch64 (#1175) |
15 | 16 | *******************************************************************************/ |
16 | 17 | package org.eclipse.cdt.debug.core; |
17 | 18 |
|
@@ -93,6 +94,10 @@ public class CDebugCorePlugin extends Plugin { |
93 | 94 | public static final String BREAKPOINT_EXTENSION_EXTENSION_POINT_ID = "BreakpointExtension"; //$NON-NLS-1$ |
94 | 95 | public static final String BREAKPOINT_EXTENSION_ELEMENT = "breakpointExtension"; //$NON-NLS-1$ |
95 | 96 |
|
| 97 | + // The preferred launch delegates for local debug sessions on macOS AArch64 |
| 98 | + private static final String PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE_MACOSX_AARCH64 = "org.eclipse.cdt.llvm.dsf.lldb.launch.attachCLaunch"; //$NON-NLS-1$ |
| 99 | + private static final String PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE_MACOSX_AARCH64 = "org.eclipse.cdt.llvm.dsf.lldb.launch.localCLaunch"; //$NON-NLS-1$ |
| 100 | + |
96 | 101 | /** |
97 | 102 | * Dummy source lookup director needed to manage common source containers. |
98 | 103 | */ |
@@ -358,17 +363,22 @@ private void setDefaultLaunchDelegates() { |
358 | 363 | // Set the default launch delegates as early as possible, and do it only once (Bug 312997) |
359 | 364 | ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager(); |
360 | 365 |
|
| 366 | + final boolean isPlatformMacosxAarch64 = Platform.OS_MACOSX.equals(Platform.getOS()) |
| 367 | + && Platform.ARCH_AARCH64.equals(Platform.getOSArch()); |
| 368 | + |
361 | 369 | HashSet<String> debugSet = new HashSet<>(); |
362 | 370 | debugSet.add(ILaunchManager.DEBUG_MODE); |
363 | 371 |
|
364 | 372 | ILaunchConfigurationType localCfg = launchMgr |
365 | 373 | .getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP); |
366 | 374 | try { |
367 | 375 | if (localCfg.getPreferredDelegate(debugSet) == null) { |
| 376 | + String preferredLocalDelegate = isPlatformMacosxAarch64 |
| 377 | + ? PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE_MACOSX_AARCH64 |
| 378 | + : ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE; |
368 | 379 | ILaunchDelegate[] delegates = localCfg.getDelegates(debugSet); |
369 | 380 | for (ILaunchDelegate delegate : delegates) { |
370 | | - if (ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE |
371 | | - .equals(delegate.getId())) { |
| 381 | + if (preferredLocalDelegate.equals(delegate.getId())) { |
372 | 382 | localCfg.setPreferredDelegate(debugSet, delegate); |
373 | 383 | break; |
374 | 384 | } |
@@ -397,10 +407,12 @@ private void setDefaultLaunchDelegates() { |
397 | 407 | .getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH); |
398 | 408 | try { |
399 | 409 | if (attachCfg.getPreferredDelegate(debugSet) == null) { |
| 410 | + String preferredAttachDelegate = isPlatformMacosxAarch64 |
| 411 | + ? PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE_MACOSX_AARCH64 |
| 412 | + : ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE; |
400 | 413 | ILaunchDelegate[] delegates = attachCfg.getDelegates(debugSet); |
401 | 414 | for (ILaunchDelegate delegate : delegates) { |
402 | | - if (ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE |
403 | | - .equals(delegate.getId())) { |
| 415 | + if (preferredAttachDelegate.equals(delegate.getId())) { |
404 | 416 | attachCfg.setPreferredDelegate(debugSet, delegate); |
405 | 417 | break; |
406 | 418 | } |
|
0 commit comments