Author: martin
Date: 2006-07-05 19:09:55 -0400 (Wed, 05 Jul 2006)
New Revision: 62288
Modified:
trunk/debugger/ChangeLog
trunk/debugger/arch/DwarfReader.cs
trunk/debugger/backends/ProcessServant.cs
trunk/debugger/classes/Breakpoint.cs
trunk/debugger/classes/DebuggerSession.cs
trunk/debugger/classes/DebuggerSession.xsd
trunk/debugger/classes/Event.cs
trunk/debugger/classes/SourceInfo.cs
trunk/debugger/classes/SourceLocation.cs
trunk/debugger/languages/mono/MonoSymbolFile.cs
Log:
2006-07-06 Martin Baulig <[EMAIL PROTECTED]>
* classes/SourceInfo.cs
(SourceMethod.ClassName): New public property.
* classes/DebuggerSession.cs
(DebuggerSession.Clone): New internal method.
* backends/ProcessServant.cs
(ProcessServant.ChildExecd): Clone the session.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2006-07-05 22:13:31 UTC (rev 62287)
+++ trunk/debugger/ChangeLog 2006-07-05 23:09:55 UTC (rev 62288)
@@ -1,3 +1,17 @@
+2006-07-06 Martin Baulig <[EMAIL PROTECTED]>
+
+ * classes/SourceInfo.cs
+ (SourceMethod.ClassName): New public property.
+
+ * classes/DebuggerSession.cs
+ (DebuggerSession.Clone): New internal method.
+
+ * backends/ProcessServant.cs
+ (ProcessServant.ChildExecd): Clone the session.
+
+ * classes/SourceLocation.cs
+ (SourceLocation): Make this actually work again.
+
2006-07-05 Martin Baulig <[EMAIL PROTECTED]>
* classes/DebuggerSession.cs
Modified: trunk/debugger/arch/DwarfReader.cs
===================================================================
--- trunk/debugger/arch/DwarfReader.cs 2006-07-05 22:13:31 UTC (rev 62287)
+++ trunk/debugger/arch/DwarfReader.cs 2006-07-05 23:09:55 UTC (rev 62288)
@@ -278,7 +278,7 @@
return source;
source = new SourceMethod (
- module, subprog.SourceFile, subprog.Offset,
subprog.Name,
+ module, subprog.SourceFile, subprog.Offset,
null, subprog.Name,
start_row, end_row, true);
method_source_hash.Add (subprog.Offset, source);
return source;
Modified: trunk/debugger/backends/ProcessServant.cs
===================================================================
--- trunk/debugger/backends/ProcessServant.cs 2006-07-05 22:13:31 UTC (rev
62287)
+++ trunk/debugger/backends/ProcessServant.cs 2006-07-05 23:09:55 UTC (rev
62288)
@@ -47,8 +47,6 @@
thread_hash = Hashtable.Synchronized (new Hashtable ());
initialized_event = new ST.ManualResetEvent (false);
-
- session.OnProcessCreated (client);
}
internal ProcessServant (ThreadManager manager, ProcessStart
start)
@@ -65,6 +63,8 @@
languages = new ArrayList ();
bfd_container = new BfdContainer (this);
+
+ session.OnProcessCreated (client);
}
private ProcessServant (ProcessServant parent, int pid)
@@ -231,6 +231,9 @@
if (breakpoint_manager != null)
breakpoint_manager.Dispose ();
+ session = session.Clone ();
+ session.OnProcessCreated (client);
+
breakpoint_manager = new BreakpointManager ();
source_factory = new SourceFileFactory ();
@@ -272,7 +275,8 @@
internal void OnProcessExitedEvent ()
{
- session.OnProcessExited (client);
+ if (!is_forked)
+ session.OnProcessExited (client);
manager.Debugger.OnProcessExitedEvent (this);
}
Modified: trunk/debugger/classes/Breakpoint.cs
===================================================================
--- trunk/debugger/classes/Breakpoint.cs 2006-07-05 22:13:31 UTC (rev
62287)
+++ trunk/debugger/classes/Breakpoint.cs 2006-07-05 23:09:55 UTC (rev
62288)
@@ -88,7 +88,7 @@
protected virtual Breakpoint Clone ()
{
- return new Breakpoint (ThreadGroup, location);
+ return new Breakpoint (GetNextEventIndex (),
ThreadGroup, location);
}
// <summary>
@@ -136,6 +136,13 @@
base.GetSessionData (row);
}
+ internal Breakpoint (int index, ThreadGroup group,
SourceLocation location)
+ : base (index, location.Name, group)
+ {
+ this.location = location;
+ this.type = BreakpointType.Breakpoint;
+ }
+
internal Breakpoint (ThreadGroup group, SourceLocation location)
: base (location.Name, group)
{
Modified: trunk/debugger/classes/DebuggerSession.cs
===================================================================
--- trunk/debugger/classes/DebuggerSession.cs 2006-07-05 22:13:31 UTC (rev
62287)
+++ trunk/debugger/classes/DebuggerSession.cs 2006-07-05 23:09:55 UTC (rev
62288)
@@ -121,6 +121,11 @@
}
}
+ internal DebuggerSession Clone ()
+ {
+ return new DebuggerSession (Config, Options);
+ }
+
//
// Modules.
//
@@ -259,7 +264,7 @@
return;
using (MemoryStream ms = new MemoryStream
(saved_session)) {
- data.LoadSession (ms);
+ data.LoadSession (process, ms);
}
}
@@ -270,11 +275,14 @@
internal void OnProcessExited (Process process)
{
- using (MemoryStream ms = new MemoryStream ()) {
- Data.SaveSession (ms);
- saved_session = ms.GetBuffer ();
+ try {
+ using (MemoryStream ms = new MemoryStream ()) {
+ Data.SaveSession (ms);
+ saved_session = ms.GetBuffer ();
+ }
+ } finally {
+ data = null;
}
- data = null;
}
public void SaveSession (Stream stream)
@@ -301,7 +309,7 @@
main_thread_group = CreateThreadGroup ("main");
}
- public void LoadSession (Stream stream)
+ public void LoadSession (Process process, Stream stream)
{
DataSet ds = new DataSet ("DebuggerSession");
@@ -350,8 +358,10 @@
long loc_index = (long) row
["location"];
SourceLocation location =
(SourceLocation) locations [loc_index];
- Breakpoint bpt = new Breakpoint (group,
location);
+ int index = (int) (long) row ["index"];
+ Breakpoint bpt = new Breakpoint (index,
group, location);
AddEvent (bpt);
+ bpt.Enable (process.MainThread);
}
}
@@ -386,6 +396,8 @@
DataTable event_table = ds.Tables ["Event"];
foreach (Event e in Events) {
+ if (!(e is Breakpoint))
+ continue;
DataRow row = event_table.NewRow ();
e.GetSessionData (row);
event_table.Rows.Add (row);
Modified: trunk/debugger/classes/DebuggerSession.xsd
===================================================================
--- trunk/debugger/classes/DebuggerSession.xsd 2006-07-05 22:13:31 UTC (rev
62287)
+++ trunk/debugger/classes/DebuggerSession.xsd 2006-07-05 23:09:55 UTC (rev
62288)
@@ -24,6 +24,7 @@
<xs:choice>
<xs:element name="method" type="xs:string" minOccurs="0" />
<xs:element name="file" type="xs:string" minOccurs="0" />
+ <xs:element name="line" type="xs:integer" minOccurs="0" />
</xs:choice>
<xs:attribute name="id" msdata:ReadOnly="true" type="xs:integer"
use="required" />
<xs:attribute name="module" msdata:ReadOnly="true" type="xs:string"
use="required" />
Modified: trunk/debugger/classes/Event.cs
===================================================================
--- trunk/debugger/classes/Event.cs 2006-07-05 22:13:31 UTC (rev 62287)
+++ trunk/debugger/classes/Event.cs 2006-07-05 23:09:55 UTC (rev 62288)
@@ -89,8 +89,12 @@
}
protected Event (string name, ThreadGroup group)
+ : this (GetNextEventIndex (), name, group)
+ { }
+
+ protected Event (int index, string name, ThreadGroup group)
{
- this.index = GetNextEventIndex ();
+ this.index = index;
this.name = name;
this.group = group;
Modified: trunk/debugger/classes/SourceInfo.cs
===================================================================
--- trunk/debugger/classes/SourceInfo.cs 2006-07-05 22:13:31 UTC (rev
62287)
+++ trunk/debugger/classes/SourceInfo.cs 2006-07-05 23:09:55 UTC (rev
62288)
@@ -115,6 +115,12 @@
}
}
+ public string ClassName {
+ get {
+ return class_name;
+ }
+ }
+
public string Name {
get {
return name;
@@ -161,17 +167,19 @@
Module module;
SourceFile source;
string name;
+ string class_name;
int start_row, end_row;
bool is_dynamic;
long handle;
public SourceMethod (Module module, SourceFile source,
- long handle, string name, int start, int
end,
- bool is_dynamic)
+ long handle, string class_name, string
name,
+ int start, int end, bool is_dynamic)
{
this.module = module;
this.source = source;
this.handle = handle;
+ this.class_name = class_name;
this.name = name;
this.start_row = start;
this.end_row = end;
Modified: trunk/debugger/classes/SourceLocation.cs
===================================================================
--- trunk/debugger/classes/SourceLocation.cs 2006-07-05 22:13:31 UTC (rev
62287)
+++ trunk/debugger/classes/SourceLocation.cs 2006-07-05 23:09:55 UTC (rev
62288)
@@ -83,10 +83,13 @@
get {
if (function != null)
return function.FullName;
- else if (line == -1)
- return source.Name;
- else if (file != null)
- return String.Format ("{0}:{1}",
SourceFile.FileName, line);
+ else if (source != null) {
+ if (line != -1)
+ return source.Name + ':' + line;
+ else
+ return source.Name;
+ } else if (file != null)
+ return SourceFile.FileName + ':' + line;
else
return method;
}
@@ -129,6 +132,10 @@
if (!row.IsNull ("method"))
method = (string) row ["method"];
+ if (!row.IsNull ("line"))
+ line = (int) (long) row ["line"];
+ else
+ line = -1;
}
internal BreakpointHandle InsertBreakpoint (Thread target,
Breakpoint breakpoint,
@@ -153,12 +160,16 @@
}
if (function != null) {
- if (function.IsLoaded) {
+ if (line > 0)
+ source = function.Source;
+ else if (function.IsLoaded) {
int index = target.InsertBreakpoint
(breakpoint, function);
return new SimpleBreakpointHandle
(breakpoint, index);
- } else
+ } else {
+ source = function.Source;
return new FunctionBreakpointHandle (
target, breakpoint, domain,
this);
+ }
}
if (source == null)
@@ -211,13 +222,25 @@
row ["method"] = function.DeclaringType.Name +
':' + function.Name;
} else if (source != null) {
row ["module"] = source.SourceFile.Module.Name;
- row ["method"] = source.Name;
+ if (source.ClassName != null) {
+ string klass = source.ClassName;
+ string name = source.Name.Substring
(klass.Length + 1);
+ row ["method"] = klass + ':' + name;
+ } else
+ row ["method"] = source.Name;
} else if (file != null) {
row ["module"] = file.Module.Name;
row ["file"] = file.Name + ":" + line;
+ } else if (method != null) {
+ row ["module"] = module.Name;
+ row ["method"] = method;
} else {
throw new InternalError ();
}
+
+ if (line > 0) {
+ row ["line"] = line;
+ }
}
private class ModuleBreakpointHandle : BreakpointHandle
Modified: trunk/debugger/languages/mono/MonoSymbolFile.cs
===================================================================
--- trunk/debugger/languages/mono/MonoSymbolFile.cs 2006-07-05 22:13:31 UTC
(rev 62287)
+++ trunk/debugger/languages/mono/MonoSymbolFile.cs 2006-07-05 23:09:55 UTC
(rev 62288)
@@ -499,8 +499,8 @@
string name = sb.ToString ();
SourceMethod method = new SourceMethod (
- Module, file, source.Index, name,
source.StartRow,
- source.EndRow, true);
+ Module, file, source.Index,
mdef.DeclaringType.FullName,
+ name, source.StartRow, source.EndRow, true);
method_index_hash.Add (index, method);
return method;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches