use of com.intellij.debugger.settings.DebuggerSettings in project kotlin by JetBrains.
the class DebuggerSteppingHelper method getActiveFilters.
// copied from DebugProcessImpl.getActiveFilters
@NotNull
private static List<ClassFilter> getActiveFilters() {
List<ClassFilter> activeFilters = new ArrayList<ClassFilter>();
DebuggerSettings settings = DebuggerSettings.getInstance();
if (settings.TRACING_FILTERS_ENABLED) {
for (ClassFilter filter : settings.getSteppingFilters()) {
if (filter.isEnabled()) {
activeFilters.add(filter);
}
}
}
for (DebuggerClassFilterProvider provider : Extensions.getExtensions(DebuggerClassFilterProvider.EP_NAME)) {
for (ClassFilter filter : provider.getFilters()) {
if (filter.isEnabled()) {
activeFilters.add(filter);
}
}
}
return activeFilters;
}
use of com.intellij.debugger.settings.DebuggerSettings in project intellij-community by JetBrains.
the class RequestHint method getNextStepDepth.
public int getNextStepDepth(final SuspendContextImpl context) {
try {
final StackFrameProxyImpl frameProxy = context.getFrameProxy();
// smart step feature stop check
if (myMethodFilter != null && frameProxy != null && !(myMethodFilter instanceof BreakpointStepMethodFilter) && myMethodFilter.locationMatches(context.getDebugProcess(), frameProxy.location()) && !isTheSameFrame(context)) {
myTargetMethodMatched = true;
return myMethodFilter.onReached(context, this);
}
if ((myDepth == StepRequest.STEP_OVER || myDepth == StepRequest.STEP_INTO) && myPosition != null) {
SourcePosition locationPosition = ContextUtil.getSourcePosition(context);
if (locationPosition != null) {
Integer resultDepth = ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
public Integer compute() {
if (myPosition.getFile().equals(locationPosition.getFile()) && isTheSameFrame(context) && !mySteppedOut) {
return isOnTheSameLine(locationPosition) ? myDepth : STOP;
}
return null;
}
});
if (resultDepth != null) {
return resultDepth.intValue();
}
}
}
// Now check filters
final DebuggerSettings settings = DebuggerSettings.getInstance();
if ((myMethodFilter != null || (settings.SKIP_SYNTHETIC_METHODS && !myIgnoreFilters)) && frameProxy != null) {
final Location location = frameProxy.location();
if (location != null) {
if (DebuggerUtils.isSynthetic(location.method())) {
return myDepth;
}
}
}
if (!myIgnoreFilters) {
if (settings.SKIP_GETTERS) {
boolean isGetter = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
public Boolean compute() {
PsiElement contextElement = ContextUtil.getContextElement(context);
return contextElement != null && DebuggerUtils.isInsideSimpleGetter(contextElement);
}
}).booleanValue();
if (isGetter) {
return StepRequest.STEP_OUT;
}
}
if (frameProxy != null) {
if (settings.SKIP_CONSTRUCTORS) {
final Location location = frameProxy.location();
if (location != null) {
final Method method = location.method();
if (method != null && method.isConstructor()) {
return StepRequest.STEP_OUT;
}
}
}
if (settings.SKIP_CLASSLOADERS) {
final Location location = frameProxy.location();
if (location != null && DebuggerUtilsEx.isAssignableFrom("java.lang.ClassLoader", location.declaringType())) {
return StepRequest.STEP_OUT;
}
}
}
for (ExtraSteppingFilter filter : ExtraSteppingFilter.EP_NAME.getExtensions()) {
try {
if (filter.isApplicable(context))
return filter.getStepRequestDepth(context);
} catch (Exception | AssertionError e) {
LOG.error(e);
}
}
}
// smart step feature
if (myMethodFilter != null && !mySteppedOut) {
return StepRequest.STEP_OUT;
}
} catch (VMDisconnectedException ignored) {
} catch (EvaluateException e) {
LOG.error(e);
}
return STOP;
}
use of com.intellij.debugger.settings.DebuggerSettings in project intellij-community by JetBrains.
the class DebugProcessImpl method getActiveFilters.
@NotNull
private static List<ClassFilter> getActiveFilters() {
DebuggerSettings settings = DebuggerSettings.getInstance();
StreamEx<ClassFilter> stream = StreamEx.of(Extensions.getExtensions(DebuggerClassFilterProvider.EP_NAME)).flatCollection(DebuggerClassFilterProvider::getFilters);
if (settings.TRACING_FILTERS_ENABLED) {
stream = stream.prepend(settings.getSteppingFilters());
}
return stream.filter(ClassFilter::isEnabled).toList();
}
use of com.intellij.debugger.settings.DebuggerSettings in project intellij-community by JetBrains.
the class HotSwapUIImpl method hotSwapSessions.
private void hotSwapSessions(final List<DebuggerSession> sessions, @Nullable final Map<String, List<String>> generatedPaths) {
final boolean shouldAskBeforeHotswap = myAskBeforeHotswap;
myAskBeforeHotswap = true;
final DebuggerSettings settings = DebuggerSettings.getInstance();
final String runHotswap = settings.RUN_HOTSWAP_AFTER_COMPILE;
final boolean shouldDisplayHangWarning = shouldDisplayHangWarning(settings, sessions);
if (shouldAskBeforeHotswap && DebuggerSettings.RUN_HOTSWAP_NEVER.equals(runHotswap)) {
return;
}
final boolean shouldPerformScan = generatedPaths == null;
final HotSwapProgressImpl findClassesProgress;
if (shouldPerformScan) {
findClassesProgress = new HotSwapProgressImpl(myProject);
} else {
boolean createProgress = false;
for (DebuggerSession session : sessions) {
if (session.isModifiedClassesScanRequired()) {
createProgress = true;
break;
}
}
findClassesProgress = createProgress ? new HotSwapProgressImpl(myProject) : null;
}
ApplicationManager.getApplication().executeOnPooledThread(() -> {
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses;
if (shouldPerformScan) {
modifiedClasses = scanForModifiedClassesWithProgress(sessions, findClassesProgress);
} else {
final List<DebuggerSession> toScan = new ArrayList<>();
final List<DebuggerSession> toUseGenerated = new ArrayList<>();
for (DebuggerSession session : sessions) {
(session.isModifiedClassesScanRequired() ? toScan : toUseGenerated).add(session);
session.setModifiedClassesScanRequired(false);
}
modifiedClasses = new HashMap<>();
if (!toUseGenerated.isEmpty()) {
modifiedClasses.putAll(HotSwapManager.findModifiedClasses(toUseGenerated, generatedPaths));
}
if (!toScan.isEmpty()) {
modifiedClasses.putAll(scanForModifiedClassesWithProgress(toScan, findClassesProgress));
}
}
final Application application = ApplicationManager.getApplication();
if (modifiedClasses.isEmpty()) {
final String message = DebuggerBundle.message("status.hotswap.uptodate");
HotSwapProgressImpl.NOTIFICATION_GROUP.createNotification(message, NotificationType.INFORMATION).notify(myProject);
return;
}
application.invokeLater(() -> {
if (shouldAskBeforeHotswap && !DebuggerSettings.RUN_HOTSWAP_ALWAYS.equals(runHotswap)) {
final RunHotswapDialog dialog = new RunHotswapDialog(myProject, sessions, shouldDisplayHangWarning);
if (!dialog.showAndGet()) {
for (DebuggerSession session : modifiedClasses.keySet()) {
session.setModifiedClassesScanRequired(true);
}
return;
}
final Set<DebuggerSession> toReload = new HashSet<>(dialog.getSessionsToReload());
for (DebuggerSession session : modifiedClasses.keySet()) {
if (!toReload.contains(session)) {
session.setModifiedClassesScanRequired(true);
}
}
modifiedClasses.keySet().retainAll(toReload);
} else {
if (shouldDisplayHangWarning) {
final int answer = Messages.showCheckboxMessageDialog(DebuggerBundle.message("hotswap.dialog.hang.warning"), DebuggerBundle.message("hotswap.dialog.title"), new String[] { "Perform &Reload Classes", "&Skip Reload Classes" }, CommonBundle.message("dialog.options.do.not.show"), false, 1, 1, Messages.getWarningIcon(), (exitCode, cb) -> {
settings.HOTSWAP_HANG_WARNING_ENABLED = !cb.isSelected();
return exitCode == DialogWrapper.OK_EXIT_CODE ? exitCode : DialogWrapper.CANCEL_EXIT_CODE;
});
if (answer == DialogWrapper.CANCEL_EXIT_CODE) {
for (DebuggerSession session : modifiedClasses.keySet()) {
session.setModifiedClassesScanRequired(true);
}
return;
}
}
}
if (!modifiedClasses.isEmpty()) {
final HotSwapProgressImpl progress = new HotSwapProgressImpl(myProject);
if (modifiedClasses.keySet().size() == 1) {
//noinspection ConstantConditions
progress.setSessionForActions(ContainerUtil.getFirstItem(modifiedClasses.keySet()));
}
application.executeOnPooledThread(() -> reloadModifiedClasses(modifiedClasses, progress));
}
}, ModalityState.NON_MODAL);
});
}
Aggregations