public int getLine() { return mySourcePosition.getLine(); }
private XBreakpoint<BallerinaBreakpointProperties> findBreakPoint(@NotNull BreakPoint breakPoint) { String fileName = breakPoint.getFileName(); String packagePath = breakPoint.getPackagePath(); String relativeFilePathInProject; // If the package is ".", full path of the file will be sent as the filename. if (".".equals(packagePath)) { // Then we need to get the actual filename from the path. int index = fileName.lastIndexOf(File.separator); if (index <= -1) { return null; } relativeFilePathInProject = fileName.substring(index); } else { // If the absolute path is not sent, we need to construct the relative file path in the project. relativeFilePathInProject = packagePath.replaceAll("\\.", File.separator) + File.separator + fileName; } int lineNumber = breakPoint.getLineNumber(); for (XBreakpoint<BallerinaBreakpointProperties> breakpoint : breakpoints) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) { continue; } VirtualFile fileInBreakpoint = breakpointPosition.getFile(); int line = breakpointPosition.getLine() + 1; if (fileInBreakpoint.getPath().endsWith(relativeFilePathInProject) && line == lineNumber) { return breakpoint; } } return null; }
int line = breakpointPosition.getLine(); Project project = getSession().getProject();
@Override public void registerBreakpoint(@NotNull XLineBreakpoint<DlvBreakpointProperties> breakpoint) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) return; VirtualFile file = breakpointPosition.getFile(); int line = breakpointPosition.getLine(); send(new DlvRequest.CreateBreakpoint(file.getPath(), line + 1)) .done(b -> { breakpoint.putUserData(ID, b.id); breakpoints.put(b.id, breakpoint); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_verified_breakpoint, null); }) .rejected(t -> { String message = t == null ? null : t.getMessage(); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, message); }); }
@Override public void runToPosition(@NotNull XSourcePosition position, XSuspendContext context) { m_gdb.sendCommand(String.format("%s %s:%s", "-exec-until", position.getFile().getPath(), (position.getLine() + 1))); }
component.append(function + "():" + (sourcePosition.getLine() + 1), SimpleTextAttributes.REGULAR_ATTRIBUTES); component.append(" (" + sourcePosition.getFile().getName() + ")", sourcePosition.getFile().getName() + ":" + (sourcePosition.getLine() + 1), SimpleTextAttributes.REGULAR_ATTRIBUTES); } else {
@Nullable public static PerlLineBreakPointDescriptor createFromSourcePosition(XSourcePosition position, PerlDebugThread debugThread) { VirtualFile virtualFile = position.getFile(); String virtualFilePath = virtualFile.getCanonicalPath(); if (virtualFilePath == null) { return null; } String filePath = debugThread.getDebugProfileState().mapPathToRemote(virtualFilePath); if (filePath == null) { return null; } PerlLineBreakPointDescriptor descriptor = new PerlLineBreakPointDescriptor(); descriptor.path = filePath; descriptor.line = position.getLine(); return descriptor; } }
String command = "-break-insert -f " + filePath + ":" + (sourcePosition.getLine() + 1); m_gdb.sendCommand(command, new Gdb.GdbEventCallback() { @Override
when(sourcePosition.getLine()).thenReturn(sourceLine); when(sourcePosition.getFile()).thenReturn(mockFile); when(mockFile.isValid()).thenReturn(Boolean.TRUE);
location.setLine(ideBreakpoint.getSourcePosition().getLine() + 1);