diff --git a/source2/Debug/Cosmos.Debug.Common/DebugInfo.cs b/source2/Debug/Cosmos.Debug.Common/DebugInfo.cs index 391dcb1bf..8d3b3eaad 100644 --- a/source2/Debug/Cosmos.Debug.Common/DebugInfo.cs +++ b/source2/Debug/Cosmos.Debug.Common/DebugInfo.cs @@ -89,11 +89,15 @@ namespace Cosmos.Debug.Common { mConnection.Open(); var xSQL = new SQL(mConnection); + // Be careful with indexes, they slow down inserts. So on tables that we have a + // lot of inserts, but limited look ups, dont add them. + // // Labels // Labels is a big table. Avoid indexes when possible, because we need inserts to be fast. // -ADDRESS - Dont index - We dont look up on it very much // -LABELNAME - We do lookup a lot on this, but will change to asm line as key prob xSQL.MakeIndex("Labels", "Name", true); + xSQL.MakeIndex("Methods", "DocumentID", false); } } } @@ -102,6 +106,16 @@ namespace Cosmos.Debug.Common { } } + // The GUIDs etc are populated by the MSBuild task, so they wont be loaded when the debugger runs. + // Because of this, we also allow manual loading. + public void LoadLookups() { + using (var xDB = DB()) { + foreach (var xDoc in xDB.Documents) { + DocumentGUIDs.Add(xDoc.Pathname, xDoc.ID); + } + } + } + public UInt32 AddressOfLabel(string aLabel) { using (var xDB = DB()) { var xRow = xDB.Labels.SingleOrDefault(q => q.Name == aLabel); @@ -244,9 +258,8 @@ namespace Cosmos.Debug.Common { } if (aFilterHiddenLines) { - //xResult = xResult.Where( + return xResult.Where(q => q.LineStart != 0xFEEFEE).ToArray(); } - return xResult; } diff --git a/source2/IL2CPU/Cosmos.IL2CPU/AppAssembler.cs b/source2/IL2CPU/Cosmos.IL2CPU/AppAssembler.cs index a326f6e49..0d694e205 100644 --- a/source2/IL2CPU/Cosmos.IL2CPU/AppAssembler.cs +++ b/source2/IL2CPU/Cosmos.IL2CPU/AppAssembler.cs @@ -85,21 +85,17 @@ namespace Cosmos.IL2CPU { // // This doesnt seem right to store as a field, but old code had it that way so we // continue using a field for now. - mSequences = DebugInfo.GetSequencePoints(aMethod.MethodBase, false); + mSequences = DebugInfo.GetSequencePoints(aMethod.MethodBase, true); if (mSequences.Length > 0) { DebugInfo.AddDocument(mSequences[0].Document); - if (mSequences[0].LineStart == 0xFEEFEE) { - int i = 1; - } - var xMethod = new Method() { TypeToken = aMethod.MethodBase.DeclaringType.MetadataToken, MethodToken = aMethod.MethodBase.MetadataToken, LabelName = xMethodLabel, AssemblyFileID = DebugInfo.AssemblyGUIDs[aMethod.MethodBase.DeclaringType.Assembly], DocumentID = DebugInfo.DocumentGUIDs[mSequences[0].Document], - LineStart = mSequences[0].LineStart, + LineStart = mSequences[0].LineStart, ColStart = mSequences[0].ColStart, LineEnd = mSequences[mSequences.Length - 1].LineEnd, ColEnd = mSequences[mSequences.Length - 1].ColEnd