• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Camelcade / Perl5-IDEA / #525521581

06 Jun 2025 08:26AM UTC coverage: 82.33% (-0.02%) from 82.354%
#525521581

push

github

hurricup
Moved debugger properties to the respective bundle

18 of 26 new or added lines in 8 files covered. (69.23%)

158 existing lines in 31 files now uncovered.

30858 of 37481 relevant lines covered (82.33%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.96
/plugin/debugger/src/main/java/com/perl5/lang/perl/debugger/PerlDebugProcess.java
1
/*
2
 * Copyright 2015-2025 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.perl.debugger;
18

19
import com.intellij.execution.ExecutionResult;
20
import com.intellij.execution.process.ProcessHandler;
21
import com.intellij.execution.ui.ExecutionConsole;
22
import com.intellij.execution.ui.RunnerLayoutUi;
23
import com.intellij.notification.Notification;
24
import com.intellij.notification.NotificationType;
25
import com.intellij.notification.Notifications;
26
import com.intellij.openapi.actionSystem.DefaultActionGroup;
27
import com.intellij.openapi.application.ApplicationManager;
28
import com.intellij.openapi.diagnostic.Logger;
29
import com.intellij.ui.content.Content;
30
import com.intellij.xdebugger.XDebugProcess;
31
import com.intellij.xdebugger.XDebugSession;
32
import com.intellij.xdebugger.XDebuggerManager;
33
import com.intellij.xdebugger.XSourcePosition;
34
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
35
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
36
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
37
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
38
import com.intellij.xdebugger.frame.XSuspendContext;
39
import com.intellij.xdebugger.ui.XDebugTabLayouter;
40
import com.perl5.PerlIcons;
41
import com.perl5.lang.perl.debugger.breakpoints.PerlLineBreakPointDescriptor;
42
import com.perl5.lang.perl.debugger.breakpoints.PerlLineBreakpointHandler;
43
import com.perl5.lang.perl.debugger.breakpoints.PerlLineBreakpointProperties;
44
import com.perl5.lang.perl.debugger.breakpoints.PerlLineBreakpointType;
45
import com.perl5.lang.perl.debugger.run.run.debugger.PerlDebugProfileStateBase;
46
import com.perl5.lang.perl.idea.run.PerlRunProfileState;
47
import com.perl5.lang.perl.idea.run.debugger.PerlDebugOptions;
48
import org.jetbrains.annotations.NonNls;
49
import org.jetbrains.annotations.NotNull;
50
import org.jetbrains.annotations.Nullable;
51

52
import java.util.Collection;
53

54

55
public class PerlDebugProcess extends XDebugProcess {
56
  private static final Logger LOG = Logger.getInstance(PerlDebugProcess.class);
1✔
57
  private final ExecutionResult myExecutionResult;
58
  private final PerlDebugThread myDebugThread;
59
  private final PerlRunProfileState myDebugProfileState;
60
  static final @NonNls String PERL_DEBUGGER_NOTIFICATION_GROUP_ID = "PERL_DEBUGGER";
61

62
  public PerlDebugProcess(@NotNull XDebugSession session, PerlDebugProfileStateBase state, ExecutionResult executionResult) {
63
    super(session);
1✔
64
    session.setPauseActionSupported(true);
1✔
65
    myExecutionResult = executionResult;
1✔
66
    myDebugThread = new PerlDebugThread(session, state, executionResult);
1✔
67
    myDebugProfileState = state;
1✔
68
    myDebugThread.start();
1✔
69
  }
1✔
70

71
  @Override
72
  public @NotNull XDebuggerEditorsProvider getEditorsProvider() {
73
    return PerlDebuggerEditorsProvider.INSTANCE;
1✔
74
  }
75

76
  @Override
77
  public boolean checkCanInitBreakpoints() {
78
    LOG.debug("Check can init breakpoints");
1✔
79
    return true;
1✔
80
  }
81

82
  @Override
83
  public XBreakpointHandler<?> @NotNull [] getBreakpointHandlers() {
84
    return new XBreakpointHandler[]{new PerlLineBreakpointHandler(myDebugThread)};
1✔
85
  }
86

87
  @Override
88
  public void sessionInitialized() {
89
    LOG.debug("Session initialized");
1✔
90
    super.sessionInitialized();
1✔
91
  }
1✔
92

93
  @Override
94
  public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar,
95
                                        @NotNull DefaultActionGroup topToolbar,
96
                                        @NotNull DefaultActionGroup settings) {
97
    super.registerAdditionalActions(leftToolbar, topToolbar, settings);
×
98
  }
×
99

100
  @Override
101
  public void startStepOver(@Nullable XSuspendContext context) {
102
    myDebugThread.sendString("o");
1✔
103
  }
1✔
104

105
  @Override
106
  public void startStepInto(@Nullable XSuspendContext context) {
107
    myDebugThread.sendString("");
1✔
108
  }
1✔
109

110
  @Override
111
  public void startStepOut(@Nullable XSuspendContext context) {
112
    myDebugThread.sendString("u");
1✔
113
  }
1✔
114

115
  @Override
116
  public void startPausing() {
117
    if (((PerlDebugOptions)myDebugProfileState.getEnvironment().getRunProfile()).isNonInteractiveModeEnabled()) {
×
118
      myDebugThread.sendString("pause");
×
119
    }
120
    else {
121
      Notifications.Bus.notify(new Notification(
×
122
        PERL_DEBUGGER_NOTIFICATION_GROUP_ID,
NEW
123
        PerlDebuggerBundle.message("perl.run.pause.unavailable.title"),
×
NEW
124
        PerlDebuggerBundle.message("perl.run.pause.unavailable.content"),
×
125
        NotificationType.INFORMATION
126
      ));
127
    }
128
  }
×
129

130
  @Override
131
  public void resume(@Nullable XSuspendContext context) {
132
    myDebugThread.sendString("g");
1✔
133
  }
1✔
134

135
  @Override
136
  public void stop() {
137
    myDebugThread.setStop();
1✔
138

139
    ApplicationManager.getApplication().runReadAction(
1✔
140
      () -> {
141
        XBreakpointManager breakpointManager = XDebuggerManager.getInstance(getSession().getProject()).getBreakpointManager();
1✔
142
        Collection<? extends XLineBreakpoint<PerlLineBreakpointProperties>> breakpoints =
1✔
143
          breakpointManager.getBreakpoints(PerlLineBreakpointType.class);
1✔
144
        for (XLineBreakpoint<PerlLineBreakpointProperties> breakpoint : breakpoints) {
1✔
145
          breakpointManager.updateBreakpointPresentation(breakpoint, null, null);
1✔
146
        }
1✔
147
      }
1✔
148
    );
149
  }
1✔
150

151
  @Override
152
  public void runToPosition(@NotNull XSourcePosition position, @Nullable XSuspendContext context) {
153
    PerlLineBreakPointDescriptor descriptor = PerlLineBreakPointDescriptor.createFromSourcePosition(position, myDebugThread);
1✔
154
    if (descriptor != null) {
1✔
155
      myDebugThread.sendCommand("p", descriptor);
1✔
156
    }
157
  }
1✔
158

159
  @Override
160
  protected @Nullable ProcessHandler doGetProcessHandler() {
161
    return myExecutionResult.getProcessHandler();
1✔
162
  }
163

164
  @Override
165
  public @NotNull ExecutionConsole createConsole() {
166
    return myExecutionResult.getExecutionConsole();
1✔
167
  }
168

169
  @Override
170
  public @NotNull XDebugTabLayouter createTabLayouter() {
171
    return new XDebugTabLayouter() {
1✔
172
      @Override
173
      public void registerAdditionalContent(@NotNull RunnerLayoutUi ui) {
174
        Content content =
1✔
175
          ui.createContent("PerlSourceList", myDebugThread.getScriptListPanel(), PerlDebuggerBundle.message("loaded.sources"),
1✔
176
                           PerlIcons.PERL_SCRIPT_FILE_ICON, null);
177
        content.setCloseable(false);
1✔
178
        ui.addContent(content);
1✔
179

180
        content =
1✔
181
          ui.createContent("PerlEvalsList", myDebugThread.getEvalsListPanel(), PerlDebuggerBundle.message("compiled.evals"),
1✔
182
                           PerlIcons.PERL_LANGUAGE_ICON, null);
183
        content.setCloseable(false);
1✔
184
        ui.addContent(content);
1✔
185
      }
1✔
186
    };
187
  }
188
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc