Author: martin
Date: 2007-07-18 12:26:03 -0400 (Wed, 18 Jul 2007)
New Revision: 82224

Modified:
   trunk/debugger/backend/arch/DwarfReader.cs
   trunk/debugger/classes/SourceAddress.cs
Log:
Sanity checks; don't crash here if we don't have source code.

Modified: trunk/debugger/backend/arch/DwarfReader.cs
===================================================================
--- trunk/debugger/backend/arch/DwarfReader.cs  2007-07-18 16:20:56 UTC (rev 
82223)
+++ trunk/debugger/backend/arch/DwarfReader.cs  2007-07-18 16:26:03 UTC (rev 
82224)
@@ -2517,8 +2517,10 @@
                                if (sc.IsContinuous)
                                        SetAddresses (sc.StartAddress, 
sc.EndAddress);
 
-                               line_numbers = new DwarfTargetLineNumberTable 
(this);
-                               SetLineNumbers (line_numbers);
+                               if (lines != null) {
+                                       line_numbers = new 
DwarfTargetLineNumberTable (this);
+                                       SetLineNumbers (line_numbers);
+                               }
 
                                if ((lines != null) && (lines.Length > 2)) {
                                        LineNumber start = lines [1];

Modified: trunk/debugger/classes/SourceAddress.cs
===================================================================
--- trunk/debugger/classes/SourceAddress.cs     2007-07-18 16:20:56 UTC (rev 
82223)
+++ trunk/debugger/classes/SourceAddress.cs     2007-07-18 16:26:03 UTC (rev 
82224)
@@ -77,11 +77,14 @@
 
                public string Name {
                        get {
-                               if (!source.IsDynamic)
-                                       return String.Format (
-                                               "{0}:{1}", 
source.SourceMethod.SourceFile.FileName, Row);
+                               if ((source.IsDynamic) || (source.SourceMethod 
== null))
+                                       return String.Format ("{0}", Row);
+
+                               SourceFile file = 
source.SourceMethod.SourceFile;
+                               if (file == null)
+                                       return String.Format ("{0}", Row);
                                else
-                                       return String.Format ("{0}", Row);
+                                       return String.Format ("{0}:{1}", 
file.FileName, Row);
                        }
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to