Exemple #1
0
 internal bool CanAddBreakpointOnLabel(AcmeLabel?label)
 {
     if (label is not null)
     {
         var line = acmePdbManager.FindLineUsingAddress(label.Address);
         return(line is not null);
     }
     return(false);
 }
Exemple #2
0
        void Registers_PropertyChanged(object?sender, PropertyChangedEventArgs e)
        {
            ushort?address = Registers.Current.PC;

            if (address.HasValue)
            {
                var matchingLine = acmePdbManager.FindLineUsingAddress(address.Value);
                if (matchingLine is not null)
                {
                    var file = acmePdbManager.FindFileOfLine(matchingLine) !;
                    int matchingLineNumber = file.Lines.IndexOf(matchingLine);
                    dispatcher.Dispatch(
                        new OpenSourceFileMessage(file, ExecutingLine: matchingLineNumber)
                        );
                    return;
                }
            }
            SourceFileViewerViewModel.ClearExecutionRow();
        }
Exemple #3
0
        /// <summary>
        /// There are three types of breakpoint to reapply: bound to label, line and unbound.
        /// </summary>
        /// <param name="breakpoints"></param>
        /// <param name="ct"></param>
        /// <returns></returns>
        internal async Task ApplyOriginalBreakpointsOnNewPdbAsync(ImmutableArray <BreakpointViewModel> breakpoints, CancellationToken ct)
        {
            var newBreakpoints = new List <BreakpointViewModel>(breakpoints.Length);

            foreach (var breakpoint in breakpoints)
            {
                bool isBreakpointReapplied = false;
                // first reapply breakpoints bound to a label
                if (breakpoint.Label is not null)
                {
                    var label = acmePdbManager.FindLabel(breakpoint.Label.Name);
                    if (label is not null)
                    {
                        var line = acmePdbManager.FindLineUsingAddress(breakpoint.Label.Address);
                        isBreakpointReapplied = true;
                    }
                    else
                    {
                        logger.Log(LogLevel.Information, "Breakpoint on label {label} not reapplied", breakpoint.Label.Name);
                    }
                }
                // then ones bound to a line
                else if (breakpoint.File is not null && breakpoint.Line is not null)
                {
                    var match = FindMatchingLine(globals.Pdb, breakpoint.File, breakpoint.Line);
                    if (match is not null)
                    {
                        breakpoint.Line = match.Value.Line;
                        breakpoint.File = match.Value.File;
                        newBreakpoints.Add(breakpoint);
                        isBreakpointReapplied = true;
                    }
                    else
                    {
                        logger.Log(LogLevel.Information, "Breakpoint on file  {file} and line {line_number} {line} not reapplied",
                                   breakpoint.File.RelativePath, breakpoint.Line.LineNumber, breakpoint.Line.Text);
                    }
                }