Browse Source

Rename DebuggedData.cs -> DebugInformation.cs;

Properly update the DebugInformation.IsDebuggerLoaded
pull/226/merge
Eusebiu Marcu 15 years ago
parent
commit
84dc577fba
  1. 8
      Debugger/ILSpy.Debugger/Commands/BreakpointCommand.cs
  2. 8
      Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs
  3. 2
      Debugger/ILSpy.Debugger/Models/TreeModel/ExpressionNode.cs
  4. 1
      Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs
  5. 16
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  6. 14
      ILSpy/AvalonEdit/IconBarMargin.cs
  7. 4
      ILSpy/Bookmarks/BreakpointBookmark.cs
  8. 4
      ILSpy/Bookmarks/CurrentLineBookmark.cs
  9. 2
      ILSpy/DebugInformation.cs
  10. 2
      ILSpy/ILSpy.csproj
  11. 2
      ILSpy/MainWindow.xaml.cs
  12. 34
      ILSpy/TextView/DecompilerTextView.cs

8
Debugger/ILSpy.Debugger/Commands/BreakpointCommand.cs

@ -18,10 +18,10 @@ namespace ICSharpCode.ILSpy.Debugger.Commands @@ -18,10 +18,10 @@ namespace ICSharpCode.ILSpy.Debugger.Commands
public void Execute(int line)
{
if (DebugData.CodeMappings != null && DebugData.CodeMappings.Count > 0) {
if (DebugInformation.CodeMappings != null && DebugInformation.CodeMappings.Count > 0) {
// check if the codemappings exists for this line
var storage = DebugData.CodeMappings;
var storage = DebugInformation.CodeMappings;
int token = 0;
foreach (var key in storage.Keys) {
var instruction = storage[key].GetInstructionByLineNumber(line, out token);
@ -32,10 +32,10 @@ namespace ICSharpCode.ILSpy.Debugger.Commands @@ -32,10 +32,10 @@ namespace ICSharpCode.ILSpy.Debugger.Commands
// no bookmark on the line: create a new breakpoint
DebuggerService.ToggleBreakpointAt(
DebugData.DecompiledMemberReferences[key],
DebugInformation.DecompiledMemberReferences[key],
line,
instruction.ILInstructionOffset,
DebugData.Language);
DebugInformation.Language);
break;
}

8
Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs

@ -83,7 +83,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands @@ -83,7 +83,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands
public override void Execute(object parameter)
{
DebugData.LoadedAssemblies = MainWindow.Instance.CurrentAssemblyList.GetAssemblies().Select(a => a.AssemblyDefinition);
DebugInformation.LoadedAssemblies = MainWindow.Instance.CurrentAssemblyList.GetAssemblies().Select(a => a.AssemblyDefinition);
}
protected static IDebugger CurrentDebugger {
@ -113,6 +113,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands @@ -113,6 +113,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands
EnableDebuggerUI(false);
CurrentDebugger.DebugStopped += OnDebugStopped;
CurrentDebugger.IsProcessRunningChanged += CurrentDebugger_IsProcessRunningChanged;
DebugInformation.IsDebuggerLoaded = true;
MainWindow.Instance.SetStatus("Running...", Brushes.Black);
}
@ -122,6 +123,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands @@ -122,6 +123,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands
EnableDebuggerUI(true);
CurrentDebugger.DebugStopped -= OnDebugStopped;
CurrentDebugger.IsProcessRunningChanged -= CurrentDebugger_IsProcessRunningChanged;
DebugInformation.IsDebuggerLoaded = false;
MainWindow.Instance.SetStatus("Stand by...", Brushes.Black);
}
@ -168,8 +170,8 @@ namespace ICSharpCode.ILSpy.Debugger.Commands @@ -168,8 +170,8 @@ namespace ICSharpCode.ILSpy.Debugger.Commands
SendWpfWindowPos(inst, HWND_TOP); inst.Activate();
// jump to type & expand folding
if (DebugData.DebugStepInformation != null)
inst.JumpToReference(DebugData.DebugStepInformation.Item3);
if (DebugInformation.DebugStepInformation != null)
inst.JumpToReference(DebugInformation.DebugStepInformation.Item3);
inst.SetStatus("Debugging...", Brushes.Red);
}

2
Debugger/ILSpy.Debugger/Models/TreeModel/ExpressionNode.cs

@ -162,7 +162,7 @@ namespace ICSharpCode.ILSpy.Debugger.Models.TreeModel @@ -162,7 +162,7 @@ namespace ICSharpCode.ILSpy.Debugger.Models.TreeModel
// get local variable index
IEnumerable<ILVariable> list;
if (DebugData.LocalVariables.TryGetValue(token, out list)) {
if (DebugInformation.LocalVariables.TryGetValue(token, out list)) {
var variable = list.FirstOrDefault(v => v.Name == targetName);
if (variable != null && variable.OriginalVariable != null) {
if (expression is MemberReferenceExpression) {

1
Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs

@ -26,7 +26,6 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -26,7 +26,6 @@ namespace ICSharpCode.ILSpy.Debugger.Services
static IDebugger GetCompatibleDebugger()
{
DebugData.IsDebuggerLoaded = true;
return currentDebugger = new WindowsDebugger();
}

16
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -283,10 +283,10 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -283,10 +283,10 @@ namespace ICSharpCode.ILSpy.Debugger.Services
int key = frame.MethodInfo.MetadataToken;
// get the mapped instruction from the current line marker or the next one
if (!DebugData.CodeMappings.ContainsKey(key))
if (!DebugInformation.CodeMappings.ContainsKey(key))
return null;
return DebugData.CodeMappings[key].GetInstructionByTokenAndOffset(key, frame.IP, out isMatch);
return DebugInformation.CodeMappings[key].GetInstructionByTokenAndOffset(key, frame.IP, out isMatch);
}
StackFrame GetStackFrame()
@ -797,9 +797,9 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -797,9 +797,9 @@ namespace ICSharpCode.ILSpy.Debugger.Services
int line;
MemberReference memberReference;
if (DebugData.CodeMappings.ContainsKey(token) &&
DebugData.CodeMappings[token].GetInstructionByTokenAndOffset(token, ilOffset, out memberReference, out line)) {
DebugData.DebugStepInformation = null; // we do not need to step into/out
if (DebugInformation.CodeMappings.ContainsKey(token) &&
DebugInformation.CodeMappings[token].GetInstructionByTokenAndOffset(token, ilOffset, out memberReference, out line)) {
DebugInformation.DebugStepInformation = null; // we do not need to step into/out
DebuggerService.RemoveCurrentLineMarker();
DebuggerService.JumpToCurrentLine(memberReference, line, 0, line, 0);
}
@ -817,14 +817,14 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -817,14 +817,14 @@ namespace ICSharpCode.ILSpy.Debugger.Services
int ilOffset = frame.IP;
string fullName = debugType.FullNameWithoutGenericArguments;
if (DebugData.LoadedAssemblies == null)
if (DebugInformation.LoadedAssemblies == null)
throw new NullReferenceException("No DebugData assemblies!");
else {
// search for type in the current assembly list
TypeDefinition typeDef = null;
TypeDefinition nestedTypeDef = null;
foreach (var assembly in DebugData.LoadedAssemblies) {
foreach (var assembly in DebugInformation.LoadedAssemblies) {
if ((assembly.FullName.StartsWith("System") || assembly.FullName.StartsWith("Microsoft") || assembly.FullName.StartsWith("mscorlib")) &&
!assembly.Name.Version.ToString().StartsWith(debuggeeVersion))
continue;
@ -847,7 +847,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -847,7 +847,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services
if (typeDef != null) {
TypeDefinition type = nestedTypeDef ?? typeDef;
DebugData.DebugStepInformation = Tuple.Create(token, ilOffset, type.GetMemberByToken(token));
DebugInformation.DebugStepInformation = Tuple.Create(token, ilOffset, type.GetMemberByToken(token));
} else {
Debug.Assert(typeDef != null, "No type was found!");
}

14
ILSpy/AvalonEdit/IconBarMargin.cs

@ -70,8 +70,8 @@ namespace ICSharpCode.ILSpy.AvalonEdit @@ -70,8 +70,8 @@ namespace ICSharpCode.ILSpy.AvalonEdit
// create a dictionary line number => first bookmark
Dictionary<int, IBookmark> bookmarkDict = new Dictionary<int, IBookmark>();
foreach (var bm in BookmarkManager.Bookmarks) {
if (DebugData.DecompiledMemberReferences == null || DebugData.DecompiledMemberReferences.Count == 0 ||
!DebugData.DecompiledMemberReferences.ContainsKey(bm.MemberReference.MetadataToken.ToInt32()))
if (DebugInformation.DecompiledMemberReferences == null || DebugInformation.DecompiledMemberReferences.Count == 0 ||
!DebugInformation.DecompiledMemberReferences.ContainsKey(bm.MemberReference.MetadataToken.ToInt32()))
continue;
int line = bm.LineNumber;
@ -244,7 +244,7 @@ namespace ICSharpCode.ILSpy.AvalonEdit @@ -244,7 +244,7 @@ namespace ICSharpCode.ILSpy.AvalonEdit
public void SyncBookmarks()
{
var storage = DebugData.CodeMappings;
var storage = DebugInformation.CodeMappings;
if (storage == null || storage.Count == 0)
return;
@ -259,7 +259,7 @@ namespace ICSharpCode.ILSpy.AvalonEdit @@ -259,7 +259,7 @@ namespace ICSharpCode.ILSpy.AvalonEdit
if (!storage.ContainsKey(key))
continue;
var member = DebugData.DecompiledMemberReferences[key];
var member = DebugInformation.DecompiledMemberReferences[key];
bool isMatch;
SourceCodeMapping map = storage[key].GetInstructionByTokenAndOffset(
@ -268,7 +268,7 @@ namespace ICSharpCode.ILSpy.AvalonEdit @@ -268,7 +268,7 @@ namespace ICSharpCode.ILSpy.AvalonEdit
if (map != null) {
newBookmarks.Add(new BreakpointBookmark(
member, new AstLocation(map.SourceCodeLine, 0),
map.ILInstructionOffset, BreakpointAction.Break, DebugData.Language));
map.ILInstructionOffset, BreakpointAction.Break, DebugInformation.Language));
BookmarkManager.RemoveMark(breakpoint);
}
@ -285,8 +285,8 @@ namespace ICSharpCode.ILSpy.AvalonEdit @@ -285,8 +285,8 @@ namespace ICSharpCode.ILSpy.AvalonEdit
if (CurrentLineBookmark.Instance == null)
return;
var oldMappings = DebugData.OldCodeMappings;
var newMappings = DebugData.CodeMappings;
var oldMappings = DebugInformation.OldCodeMappings;
var newMappings = DebugInformation.CodeMappings;
if (oldMappings == null || newMappings == null)
return;

4
ILSpy/Bookmarks/BreakpointBookmark.cs

@ -90,8 +90,8 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks @@ -90,8 +90,8 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
ITextMarker marker = markerService.Create(offset, length);
marker.BackgroundColor = Color.FromRgb(180, 38, 38);
marker.ForegroundColor = Colors.White;
marker.IsVisible = b => b is MarkerBookmark && DebugData.DecompiledMemberReferences != null &&
DebugData.DecompiledMemberReferences.ContainsKey(((MarkerBookmark)b).MemberReference.MetadataToken.ToInt32());
marker.IsVisible = b => b is MarkerBookmark && DebugInformation.DecompiledMemberReferences != null &&
DebugInformation.DecompiledMemberReferences.ContainsKey(((MarkerBookmark)b).MemberReference.MetadataToken.ToInt32());
marker.Bookmark = this;
this.Marker = marker;

4
ILSpy/Bookmarks/CurrentLineBookmark.cs

@ -82,8 +82,8 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks @@ -82,8 +82,8 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
ITextMarker marker = markerService.Create(offset + startColumn - 1, length + 1);
marker.BackgroundColor = Colors.Yellow;
marker.ForegroundColor = Colors.Blue;
marker.IsVisible = b => b is MarkerBookmark && DebugData.DecompiledMemberReferences != null &&
DebugData.DecompiledMemberReferences.ContainsKey(((MarkerBookmark)b).MemberReference.MetadataToken.ToInt32());
marker.IsVisible = b => b is MarkerBookmark && DebugInformation.DecompiledMemberReferences != null &&
DebugInformation.DecompiledMemberReferences.ContainsKey(((MarkerBookmark)b).MemberReference.MetadataToken.ToInt32());
marker.Bookmark = this;
this.Marker = marker;
return marker;

2
ILSpy/DebuggedData.cs → ILSpy/DebugInformation.cs

@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Debugger @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Debugger
/// <summary>
/// Contains the data important for debugger from the main application.
/// </summary>
public static class DebugData
public static class DebugInformation
{
static DecompiledLanguages language;

2
ILSpy/ILSpy.csproj

@ -123,7 +123,7 @@ @@ -123,7 +123,7 @@
<Compile Include="Commands\ExportCommandAttribute.cs" />
<Compile Include="Controls\SearchBox.cs" />
<Compile Include="Controls\SortableGridViewColumn.cs" />
<Compile Include="DebuggedData.cs" />
<Compile Include="DebugInformation.cs" />
<Compile Include="Languages\CSharpLanguage.cs" />
<Compile Include="DecompilationOptions.cs" />
<Compile Include="ExtensionMethods.cs" />

2
ILSpy/MainWindow.xaml.cs

@ -499,7 +499,7 @@ namespace ICSharpCode.ILSpy @@ -499,7 +499,7 @@ namespace ICSharpCode.ILSpy
void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
if (!DebugData.IsDebuggerLoaded) {
if (!DebugInformation.IsDebuggerLoaded) {
var path = GetPathForNode(treeView.SelectedItem as SharpTreeNode);
ShowAssemblyList(assemblyListManager.LoadList(ILSpySettings.Load(), assemblyList.ListName));
SelectNode(FindNodeByPath(path, true));

34
ILSpy/TextView/DecompilerTextView.cs

@ -447,19 +447,19 @@ namespace ICSharpCode.ILSpy.TextView @@ -447,19 +447,19 @@ namespace ICSharpCode.ILSpy.TextView
iconMargin.SyncBookmarks();
if (isDecompilationOk) {
if (DebugData.DebugStepInformation != null) {
if (DebugInformation.DebugStepInformation != null) {
// repaint bookmarks
iconMargin.InvalidateVisual();
// show the currentline marker
int token = DebugData.DebugStepInformation.Item1;
int ilOffset = DebugData.DebugStepInformation.Item2;
int token = DebugInformation.DebugStepInformation.Item1;
int ilOffset = DebugInformation.DebugStepInformation.Item2;
int line;
MemberReference member;
if (!DebugData.CodeMappings.ContainsKey(token))
if (!DebugInformation.CodeMappings.ContainsKey(token))
return;
DebugData.CodeMappings[token].GetInstructionByTokenAndOffset(token, ilOffset, out member, out line);
DebugInformation.CodeMappings[token].GetInstructionByTokenAndOffset(token, ilOffset, out member, out line);
// update marker
CurrentLineBookmark.Remove();
@ -525,12 +525,12 @@ namespace ICSharpCode.ILSpy.TextView @@ -525,12 +525,12 @@ namespace ICSharpCode.ILSpy.TextView
void DecompileNodes(DecompilationContext context, ITextOutput textOutput)
{
// reset data
DebugData.OldCodeMappings = DebugData.CodeMappings;
DebugData.CodeMappings = null;
DebugData.LocalVariables = null;
DebugData.DecompiledMemberReferences = null;
DebugInformation.OldCodeMappings = DebugInformation.CodeMappings;
DebugInformation.CodeMappings = null;
DebugInformation.LocalVariables = null;
DebugInformation.DecompiledMemberReferences = null;
// set the language
DebugData.Language = MainWindow.Instance.sessionSettings.FilterSettings.Language.Name.StartsWith("IL") ? DecompiledLanguages.IL : DecompiledLanguages.CSharp;
DebugInformation.Language = MainWindow.Instance.sessionSettings.FilterSettings.Language.Name.StartsWith("IL") ? DecompiledLanguages.IL : DecompiledLanguages.CSharp;
var nodes = context.TreeNodes;
context.Language.DecompileFinished += Language_DecompileFinished;
@ -554,15 +554,15 @@ namespace ICSharpCode.ILSpy.TextView @@ -554,15 +554,15 @@ namespace ICSharpCode.ILSpy.TextView
iconMargin.DecompiledMembers.AddRange(e.DecompiledMemberReferences.Values.AsEnumerable());
// debugger info
if (DebugData.CodeMappings == null) {
DebugData.CodeMappings = e.CodeMappings;
DebugData.LocalVariables = e.LocalVariables;
DebugData.DecompiledMemberReferences = e.DecompiledMemberReferences;
if (DebugInformation.CodeMappings == null) {
DebugInformation.CodeMappings = e.CodeMappings;
DebugInformation.LocalVariables = e.LocalVariables;
DebugInformation.DecompiledMemberReferences = e.DecompiledMemberReferences;
} else {
DebugData.CodeMappings.AddRange(e.CodeMappings);
DebugData.DecompiledMemberReferences.AddRange(e.DecompiledMemberReferences);
DebugInformation.CodeMappings.AddRange(e.CodeMappings);
DebugInformation.DecompiledMemberReferences.AddRange(e.DecompiledMemberReferences);
if (e.LocalVariables != null)
DebugData.LocalVariables.AddRange(e.LocalVariables);
DebugInformation.LocalVariables.AddRange(e.LocalVariables);
}
} else {
manager.UpdateClassMemberBookmarks(null);

Loading…
Cancel
Save