Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 14 commits
  • 21 files changed
  • 0 commit comments
  • 4 contributors
Commits on Jul 31, 2008
@slluis slluis 2008-07-31 Lluis Sanchez Gual <lluis@novell.com>
	* classes/GUIManager.cs: Make sure events from individual threads
	are not sent to the GUI. Added callback called when a breakpoint
	is hit.
	

svn path=/branches/mono-2-0/debugger/; revision=109324
3985d67
Martin Baulig **** Merged from trunk ****
svn path=/branches/mono-2-0/debugger/; revision=109337
b0d06fc
Martin Baulig **** Merged from trunk ****
svn path=/branches/mono-2-0/debugger/; revision=109341
3474e9d
Martin Baulig Stupid automake
svn path=/branches/mono-2-0/debugger/; revision=109350
a5617ae
Martin Baulig Ooops
svn path=/branches/mono-2-0/debugger/; revision=109352
aa46202
Martin Baulig 2008-07-31 Martin Baulig <martin@ximian.com>
	* classes/Debugger.cs
	(Debugger.ModuleLoadedEvent): New public event.
	(Debugger.ModuleUnLoadedEvent): New public event.


svn path=/branches/mono-2-0/debugger/; revision=109361
955f289
Andrew Jorgensen Bump version to 2.0
svn path=/branches/mono-2-0/debugger/; revision=109371
cf10023
Commits on Aug 05, 2008
Martin Baulig 2008-08-05 Martin Baulig <martin@ximian.com>
	Released version 1.0 "Cologne" of the Mono Debugger :-)

	* NEWS: Updated to 1.0.


svn path=/branches/mono-2-0/debugger/; revision=109668
a6641af
Commits on Aug 06, 2008
@migueldeicaza migueldeicaza Update configure.in
svn path=/branches/mono-2-0/debugger/; revision=109768
616e4f6
Commits on Aug 07, 2008
Martin Baulig 2008-08-05 Martin Baulig <martin@ximian.com>
	Released version 2.0 "Cologne" of the Mono Debugger :-)

	* NEWS: Updated to 2.0.


svn path=/branches/mono-2-0/debugger/; revision=109844
a9b397c
Commits on Aug 13, 2008
Martin Baulig **** Merged from trunk ****
svn path=/branches/mono-2-0/debugger/; revision=110418
d8ee187
Commits on Aug 15, 2008
Martin Baulig **** Merged from trunk ****
svn path=/branches/mono-2-0/debugger/; revision=110595
aec9e23
Commits on Aug 19, 2008
Martin Baulig **** Merged r110908 from trunk ****
svn path=/branches/mono-2-0/debugger/; revision=110911
777a7f3
Commits on Sep 03, 2008
@slluis slluis 2008-10-03 Lluis Sanchez Gual <lluis@novell.com>
	* classes/GUIManager.cs: Revert my changes.
	

svn path=/branches/mono-2-0/debugger/; revision=112151
38c45a7
View
40 ChangeLog
@@ -1,3 +1,43 @@
+2008-10-03 Lluis Sanchez Gual <lluis@novell.com>
+
+ * classes/GUIManager.cs: Revert my changes.
+
+2008-08-19 Martin Baulig <martin@ximian.com>
+
+ * backend/ThreadManager.cs: Fixed a hard to find race condition.
+
+2008-08-14 Martin Baulig <martin@ximian.com>
+
+ * symbolwriter/MdbSymbolReader.cs: Add `-verbose' command line
+ argument and improve the scope variables check.
+
+2008-08-13 Martin Baulig <martin@ximian.com>
+
+ * test/testsuite/TestAttach.cs
+ (TestAttach.TearDown): Call `child.WaitForExit()' here since
+ TestAttach.Kill() may not be run if the test is disabled.
+
+ * test/testsuite/testnativeattach.cs
+ (testnativeattach.TearDown): Call `child.WaitForExit()' here since
+ testnativeattach.Kill() may not be run if the test is disabled.
+
+2008-08-11 Martin Baulig <martin@ximian.com>
+
+ * test/testsuite/testnativefork.cs: Override debugger config; this
+ test needs "broken-threading = false", "stay-in-thread = true".
+
+2008-08-05 Martin Baulig <martin@ximian.com>
+
+ Released version 2.0 "Cologne" of the Mono Debugger :-)
+
+ * NEWS: Updated to 2.0.
+
+2008-07-31 Martin Baulig <martin@ximian.com>
+
+ * classes/Debugger.cs
+ (Debugger.ModuleLoadedEvent): New public event.
+ (Debugger.ModuleUnLoadedEvent): New public event.
+
2008-07-31 Martin Baulig <martin@ximian.com>
**** The Debugger has been branched for Mono 2.0 ****
View
15 NEWS
@@ -1,3 +1,16 @@
+August 5th, 2008 - Martin Baulig
+--------------------------------
+
+Released version 2.0 "Cologne" of the Mono Debugger :-)
+
+- This is a stable release for Mono 2.0 and will be supported
+ for a long period of time.
+
+- As requested by the Mono Release Team, the version number was
+ changed to 2.0. There is now 1.0.
+
+- Lots of bug fixes went in since 0.80.
+
March 14th, 2008 - Martin Baulig
--------------------------------
@@ -16,7 +29,7 @@ Released version 0.80 "Terrania City" of the Mono Debugger :-)
get their types yet.
* Support for anonymous methods and iterators should now be pretty
- much complete; we can fully debug them, access captured
+ much complete; we can fully debug them, access captured
variables etc.
* There are a few single-stepping improvements.
View
10 backend/DebuggerServant.cs
@@ -47,6 +47,16 @@ internal class DebuggerServant : DebuggerMarshalByRefObject, IDisposable
get { return thread_manager; }
}
+ internal void OnModuleLoaded (Module module)
+ {
+ client.OnModuleLoadedEvent (module);
+ }
+
+ internal void OnModuleUnLoaded (Module module)
+ {
+ client.OnModuleUnLoadedEvent (module);
+ }
+
internal void OnMainProcessCreatedEvent (ProcessServant process)
{
client.OnMainProcessCreatedEvent (process.Client);
View
5 backend/SingleSteppingEngine.cs
@@ -2654,8 +2654,9 @@ protected override void DoExecute ()
out TargetEventArgs args)
{
Report.Debug (DebugFlags.SSE,
- "{0} executed instruction {1} at {2}: {3}",
- sse, Instruction, inferior.CurrentFrame, cevent);
+ "{0} executed instruction at {1}: {2}\n{3}",
+ sse, inferior.CurrentFrame, cevent,
+ TargetBinaryReader.HexDump (Instruction));
args = null;
if (pushed_code_buffer) {
View
3  backend/ThreadManager.cs
@@ -330,7 +330,8 @@ void engine_thread_main ()
check_pending_events ();
- engine_event.Set ();
+ if (command == null)
+ engine_event.Set ();
RequestWait ();
}
View
2  build/Makefile.am
@@ -26,7 +26,7 @@ noinst_SCRIPTS = \
Mono.Debugger.Test.dll
LANGUAGE_SPECIFIC_FILES = \
- $(top_srcdir)/frontend/CSharpExpressionParser.cs \
+ $(top_builddir)/frontend/CSharpExpressionParser.cs \
$(top_srcdir)/frontend/CSharpTokenizer.cs
MDB_SRCLIST = \
View
14 classes/Debugger.cs
@@ -55,6 +55,8 @@ public Debugger (DebuggerConfiguration config)
public event ProcessEventHandler ProcessCreatedEvent;
public event ProcessEventHandler ProcessExitedEvent;
public event ProcessEventHandler ProcessExecdEvent;
+ public event ModuleEventHandler ModuleLoadedEvent;
+ public event ModuleEventHandler ModuleUnLoadedEvent;
public event DebuggerEventHandler TargetExitedEvent;
public event TargetEventHandler TargetEvent;
public event SymbolTableChangedHandler SymbolTableChanged;
@@ -127,6 +129,18 @@ internal void OnTargetEvent (Thread thread, TargetEventArgs args)
TargetEvent (thread, args);
}
+ internal void OnModuleLoadedEvent (Module module)
+ {
+ if (ModuleLoadedEvent != null)
+ ModuleLoadedEvent (module);
+ }
+
+ internal void OnModuleUnLoadedEvent (Module module)
+ {
+ if (ModuleUnLoadedEvent != null)
+ ModuleUnLoadedEvent (module);
+ }
+
public void Kill ()
{
if (servant != null) {
View
113 classes/GUIManager.cs
@@ -25,20 +25,10 @@ internal GUIManager (Process process)
ST.Thread manager_thread;
ST.AutoResetEvent manager_event;
Queue<Event> event_queue;
-
- object stopLock = new object ();
- List<Thread> stoppedList;
- bool stopping;
-
- BreakpointHitHandler breakpointHitHandler;
+ bool break_mode;
public event TargetEventHandler TargetEvent;
-
- public BreakpointHitHandler BreakpointHitHandler {
- get { return breakpointHitHandler; }
- set { breakpointHitHandler = value; }
- }
public void StartGUIManager ()
{
@@ -52,51 +42,28 @@ internal void OnTargetEvent (SingleSteppingEngine sse, TargetEventArgs args)
{
switch (args.Type){
case TargetEventType.TargetHitBreakpoint:
- case TargetEventType.Exception:
case TargetEventType.TargetStopped:
- case TargetEventType.TargetInterrupted:
- case TargetEventType.TargetSignaled:
case TargetEventType.UnhandledException:
+ case TargetEventType.Exception:
handle_autostop_event (sse, args);
break;
- case TargetEventType.TargetExited:
- case TargetEventType.FrameChanged:
- // Ignore
+ case TargetEventType.TargetInterrupted:
+ if (!break_mode) {
+ args = new TargetEventArgs (TargetEventType.TargetStopped, 0);
+ handle_autostop_event (sse, args);
+ }
+ break;
+
+ default:
+ SendTargetEvent (sse.Thread, args);
break;
}
}
void handle_autostop_event (SingleSteppingEngine sse, TargetEventArgs args)
{
- bool stopRequested = true;
-
- // Always run the breakpoint handler for breakpoint hits,
- // even when the debugger is already stopping
- if ((args.Type == TargetEventType.TargetHitBreakpoint || args.Type == TargetEventType.Exception) && breakpointHitHandler != null)
- stopRequested = breakpointHitHandler (args);
-
- lock (stopLock) {
-
- // If the debugger is already being stopped, make sure this event doesn't
- // reach the GUI.
- if (stopping) {
- if (!stoppedList.Contains (sse.Thread)) {
- stoppedList.Add (sse.Thread);
- ST.Monitor.Pulse (stopLock);
- }
- return;
- }
-
- // If the thread doesn't need to be stopped, resume it here
- if (!stopRequested) {
- Continue (sse.Thread);
- return;
- }
-
- stopping = true;
- stoppedList = new List<Thread> ();
- }
+ break_mode = true;
List<Thread> stopped = new List<Thread> ();
@@ -118,12 +85,15 @@ void handle_autostop_event (SingleSteppingEngine sse, TargetEventArgs args)
stopped.Add (thread);
}
- QueueEvent (new StopEvent {
- Manager = this, Thread = sse.Client, Args = args,
- Stopped = stopped
- });
+ lock (event_queue) {
+ event_queue.Enqueue (new StoppingEvent {
+ Manager = this, Thread = sse.Client, Args = args,
+ Stopped = stopped
+ });
+ manager_event.Set ();
+ }
}
-
+
internal void SendTargetEvent (Thread thread, TargetEventArgs args)
{
try {
@@ -135,24 +105,17 @@ internal void SendTargetEvent (Thread thread, TargetEventArgs args)
}
}
- protected void ProcessStopEvent (StopEvent e)
+ protected void ProcessStoppingEvent (StoppingEvent e)
{
- // Wait until all threads have reported a stop event.
- // Waiting on the wait handle is not enough since
- // events are fired asynchronously, so they might come
- // after the wait handle is signaled
-
- lock (stopLock) {
- while (stoppedList.Count != e.Stopped.Count) {
- ST.Monitor.Wait (stopLock);
- }
- stoppedList = null;
- stopping = false;
- }
+ List<ST.WaitHandle> wait_list = new List<ST.WaitHandle> ();
+ foreach (Thread thread in e.Stopped)
+ wait_list.Add (thread.WaitHandle);
+
+ ST.WaitHandle.WaitAll (wait_list.ToArray ());
SendTargetEvent (e.Thread, e.Args);
}
-
+
protected void QueueEvent (Event e)
{
lock (event_queue) {
@@ -160,10 +123,10 @@ protected void QueueEvent (Event e)
manager_event.Set ();
}
}
-
- public void Break (Thread thread)
+
+ public void Stop (Thread thread)
{
- QueueEvent (new BreakEvent { Manager = this, Thread = thread });
+ QueueEvent (new StopEvent { Manager = this, Thread = thread });
}
public void Continue (Thread thread)
@@ -188,6 +151,7 @@ public void StepOut (Thread thread)
void ProcessRunEvent (RunEvent e)
{
+ break_mode = false;
Thread[] threads = Process.GetThreads ();
foreach (Thread t in threads) {
if (t == e.Thread)
@@ -224,7 +188,7 @@ protected abstract class Event
public abstract void ProcessEvent ();
}
- protected class StopEvent : Event
+ protected class StoppingEvent : Event
{
public Thread Thread {
get; set;
@@ -240,10 +204,11 @@ protected class StopEvent : Event
public override void ProcessEvent ()
{
- Manager.ProcessStopEvent (this);
+ Manager.ProcessStoppingEvent (this);
}
}
+
protected abstract class RunEvent : Event
{
public Thread Thread {
@@ -291,14 +256,16 @@ protected override void DoRun ()
}
}
- protected class BreakEvent : RunEvent
+ protected class StopEvent : Event
{
- protected override void DoRun ()
+ public Thread Thread {
+ get; set;
+ }
+
+ public override void ProcessEvent ()
{
Thread.ThreadServant.Stop ();
}
}
}
-
- public delegate bool BreakpointHitHandler (TargetEventArgs args);
}
View
2  configure.in
@@ -2,7 +2,7 @@
AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono-debugger, 0.99)
+AM_INIT_AUTOMAKE(mono-debugger, 2.0)
AM_MAINTAINER_MODE
AC_CHECK_TOOL(CC, gcc, gcc)
View
13 frontend/Makefile.am
@@ -1,17 +1,16 @@
SUBDIRS = jay libedit
-if COMPILING_FROM_SVN
-
-noinst_DATA = $(real_top_srcdir)/frontend/CSharpExpressionParser.cs
+noinst_DATA = CSharpExpressionParser.cs
JAY = jay/jay
CSLEX = $(top_builddir)/cslex/cslex.exe
-$(real_top_srcdir)/frontend/CSharpExpressionParser.cs: CSharpExpressionParser.jay $(srcdir)/skeleton
- $(JAY) -ctv < $(srcdir)/skeleton $(real_top_srcdir)/frontend/CSharpExpressionParser.jay > tmp-p && mv -f tmp-p $(real_top_srcdir)/frontend/CSharpExpressionParser.cs
+CSharpExpressionParser.cs: CSharpExpressionParser.jay $(srcdir)/skeleton
+ $(JAY) -ctv < $(srcdir)/skeleton $(srcdir)/CSharpExpressionParser.jay > tmp-p && mv -f tmp-p CSharpExpressionParser.cs
DISTCLEANFILES = CSharpExpressionParser.cs y.output
-endif
-
EXTRA_DIST = skeleton CSharpExpressionParser.jay $(srcdir)/*.cs
+
+dist-hook:
+ rm -f CSharpExpressionParser.cs
View
15 languages/mono/MonoLanguageBackend.cs
@@ -709,12 +709,8 @@ MonoSymbolFile load_symfile (TargetMemoryAccess memory, TargetAddress address)
return symfile;
}
- void close_symfile (int index)
+ void close_symfile (MonoSymbolFile symfile)
{
- MonoSymbolFile symfile = (MonoSymbolFile) symfile_by_index [index];
- if (symfile == null)
- throw new InternalError ();
-
symfile_by_image_addr.Remove (symfile.MonoImage);
assembly_hash.Remove (symfile.Assembly);
assembly_by_name.Remove (symfile.Assembly.Name.FullName);
@@ -1312,6 +1308,7 @@ internal void InitializeAttach (TargetMemoryAccess memory)
MonoSymbolFile symfile = load_symfile (inferior, data);
Report.Debug (DebugFlags.JitSymtab,
"Module load: {0} {1}", data, symfile);
+ engine.Process.Debugger.OnModuleLoaded (symfile.Module);
if ((builtin_types != null) && (symfile != null)) {
if (engine.OnModuleLoaded ())
return false;
@@ -1322,7 +1319,13 @@ internal void InitializeAttach (TargetMemoryAccess memory)
case NotificationType.UnloadModule:
Report.Debug (DebugFlags.JitSymtab,
"Module unload: {0} {1}", data, arg);
- close_symfile ((int) arg);
+
+ MonoSymbolFile symfile = (MonoSymbolFile) symfile_by_index [(int) arg];
+ if (symfile == null)
+ throw new InternalError ();
+
+ engine.Process.Debugger.OnModuleUnLoaded (symfile.Module);
+ close_symfile (symfile);
break;
case NotificationType.JitBreakpoint:
View
17 languages/mono/MonoSymbolFile.cs
@@ -235,18 +235,19 @@ internal class MonoSymbolFile : SymbolFile
try {
File = C.MonoSymbolFile.ReadSymbolFile (Assembly, mdb_file);
+ if (File == null)
+ Report.Error ("Cannot load symbol file `{0}'", mdb_file);
+ else if (ModuleDefinition.Mvid != File.Guid) {
+ Report.Error ("Symbol file `{0}' does not match assembly `{1}'",
+ mdb_file, ImageFile);
+ File = null;
+ }
+ } catch (C.MonoSymbolFileException ex) {
+ Report.Error (ex.Message);
} catch (Exception ex) {
Report.Error ("Cannot load symbol file `{0}': {1}", mdb_file, ex);
}
- if (File == null)
- Report.Error ("Cannot load symbol file `{0}'", mdb_file);
- else if (ModuleDefinition.Mvid != File.Guid) {
- Report.Error ("Symbol file `{0}' does not match assembly `{1}'",
- mdb_file, ImageFile);
- File = null;
- }
-
symtab = new MonoSymbolTable (this);
name = Assembly.Name.FullName;
View
31 symbolwriter/MdbSymbolReader.cs
@@ -11,7 +11,7 @@ public class MdbSymbolReader
public readonly Cecil.AssemblyDefinition Assembly;
public readonly MonoSymbolFile File;
- public bool Verbose {
+ public static bool Verbose {
get; set;
}
@@ -299,25 +299,37 @@ protected void CheckMethod (MethodEntry method)
ScopeVariable[] scope_vars = method.GetScopeVariables () ?? new ScopeVariable [0];
foreach (ScopeVariable var in scope_vars) {
Debug (" {0} scope var: {1}", method, var);
+ if ((mdef.IsStatic) && (var.Index < 0))
+ throw new MonoSymbolFileException (
+ "Method {0} has invalid scope variable {1} (referencing `this' in static method).",
+ name, var);
if ((var.Index >= 0) && (var.Index >= num_locals))
- throw new MonoSymbolFileException ("Method {0} has invalid scope variable {1}.",
- name, var);
+ throw new MonoSymbolFileException (
+ "Method {0} has invalid scope variable {1} (index out of bounds: {2} / {3}).",
+ name, var, var.Index, num_locals);
if ((var.Scope > 0) && (File.GetAnonymousScope (var.Scope) == null))
- throw new MonoSymbolFileException ("Method {0} has invalid scope variable {1}.",
- name, var);
+ throw new MonoSymbolFileException (
+ "Method {0} has invalid scope variable {1} (can't find scope {2}).",
+ name, var, var.Scope);
}
}
static int Main (string[] args)
{
if (args.Length < 1) {
- Console.WriteLine ("USAGE: mdb-symbolwriter filename...filename");
+ Console.WriteLine ("USAGE: mdb-symbolwriter [-verbose] filename...filename");
return 1;
}
+ int i = 0;
+ if ((args [0] == "-verbose") || (args [0] == "--verbose")) {
+ Verbose = true;
+ i++;
+ }
+
bool fail = false;
- foreach (string filename in args) {
- int ret = Check (filename);
+ for (; i < args.Length; i++) {
+ int ret = Check (args [i]);
if (ret < 0)
fail = true;
}
@@ -331,14 +343,13 @@ static int Check (string filename)
try {
asm = Mono.Cecil.AssemblyFactory.GetAssembly (filename);
- file = MonoSymbolFile.ReadSymbolFile (asm, filename);
+ file = MonoSymbolFile.ReadSymbolFile (asm, filename + ".mdb");
} catch (Exception ex) {
Console.WriteLine ("Can't read {0}: {1}", filename, ex.Message);
return -1;
}
MdbSymbolReader reader = new MdbSymbolReader (asm, file);
- reader.Verbose = false;
try {
reader.Read ();
View
11 symbolwriter/MonoSymbolFile.cs
@@ -393,8 +393,15 @@ public void CreateSymbolFile (Guid guid, FileStream fs)
MonoSymbolFile (string filename)
{
this.FileName = filename;
- FileStream stream = new FileStream (filename, FileMode.Open, FileAccess.Read);
- reader = new MyBinaryReader (stream);
+
+ FileStream stream;
+ try {
+ stream = new FileStream (filename, FileMode.Open, FileAccess.Read);
+ reader = new MyBinaryReader (stream);
+ } catch (IOException ex) {
+ throw new MonoSymbolFileException (
+ "Cannot read symbol file `{0}': {1}", filename, ex.Message);
+ }
try {
long magic = reader.ReadInt64 ();
View
4 test/testsuite/NUnit.cs
@@ -301,6 +301,10 @@ protected int GetLine (string text)
get { return interpreter; }
}
+ public DebuggerConfiguration Config {
+ get { return config; }
+ }
+
public static string SourceDirectory {
get {
string srcdir = Path.Combine (BuildInfo.srcdir, "../test/src/");
View
5 test/testsuite/TestAppDomain-Module.cs
@@ -12,7 +12,10 @@ public class TestAppDomainModule : TestSuite
{
public TestAppDomainModule ()
: base ("TestAppDomain-Module")
- { }
+ {
+ Config.BrokenThreading = false;
+ Config.StayInThread = true;
+ }
const int LineHelloWorld = 7;
View
5 test/testsuite/TestAppDomain.cs
@@ -12,7 +12,10 @@ public class TestAppDomain : TestSuite
{
public TestAppDomain ()
: base ("TestAppDomain")
- { }
+ {
+ Config.BrokenThreading = false;
+ Config.StayInThread = true;
+ }
int bpt_hello;
View
2  test/testsuite/TestAttach.cs
@@ -40,6 +40,7 @@ public override void TearDown ()
if (!child.HasExited)
child.Kill ();
+ child.WaitForExit ();
}
[Test]
@@ -109,7 +110,6 @@ public void Kill ()
process.Kill ();
AssertTargetExited (process);
- child.WaitForExit ();
}
}
}
View
4 test/testsuite/TestMultiThread.cs
@@ -12,7 +12,9 @@ public class TestMultiThread : TestSuite
{
public TestMultiThread ()
: base ("TestMultiThread")
- { }
+ {
+ Config.BrokenThreading = true;
+ }
const int LineMain = 51;
const int LineLoop = 32;
View
3  test/testsuite/testnativeattach.cs
@@ -39,6 +39,7 @@ public override void TearDown ()
if (!child.HasExited)
child.Kill ();
+ child.WaitForExit ();
}
[Test]
@@ -99,8 +100,6 @@ public void Kill ()
process.Kill ();
AssertTargetExited (process);
-
- child.WaitForExit ();
}
}
}
View
5 test/testsuite/testnativefork.cs
@@ -12,7 +12,10 @@ public class testnativefork : TestSuite
{
public testnativefork ()
: base ("testnativefork", "testnativefork.c")
- { }
+ {
+ Config.BrokenThreading = false;
+ Config.StayInThread = true;
+ }
const int LineMain = 12;
const int LineWaitpid = 16;

No commit comments for this range

Something went wrong with that request. Please try again.