Author: martin
Date: 2007-12-08 10:46:59 -0500 (Sat, 08 Dec 2007)
New Revision: 90993
Modified:
trunk/debugger/ChangeLog
trunk/debugger/backend/Inferior.cs
trunk/debugger/backend/ProcessServant.cs
trunk/debugger/backend/SingleSteppingEngine.cs
trunk/debugger/backend/server/i386-arch.c
trunk/debugger/backend/server/library.c
trunk/debugger/backend/server/server.h
trunk/debugger/backend/server/x86-arch.h
trunk/debugger/backend/server/x86-linux-ptrace.c
trunk/debugger/backend/server/x86-ptrace.c
trunk/debugger/backend/server/x86_64-arch.c
trunk/debugger/classes/DebuggerConfiguration.cs
trunk/debugger/configure.in
trunk/debugger/frontend/Command.cs
trunk/debugger/frontend/Interpreter.cs
trunk/debugger/test/testsuite/NUnit.cs
Log:
2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
* configure.in: Bumped version number to 0.60.
2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
Changed default behavior: don't follow fork() by default.
* classes/DebuggerConfiguration.cs
(DebuggerConfiguration.FollowFork): Changed default to false.
* test/testsuite/NUnit.cs
(NUnitInterpreter.ctor): Override configuration: enable `FollowFork'.
2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
* frontend/Command.cs
(ConfigCommand): New command.
2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
* backend/Inferior.cs
(Inferior): Replaced InitializeAfterFork() by DetachAfterFork().
* backend/SingleSteppingEngine.cs
(SSE.InitAfterFork): New method.
(OperationInitializeAfterFork): New operation. To avoid a race
condition, we need to wait until the target stopped the first time
before we can disable the local breakpoints.
* backend/server/server.h
(mono_debugger_server_init_after_fork): Renamed info
mono_debugger_server_detach_after_fork().
* backend/server/x86-arch.h
(x86_arch_enable_breakpoint): Add prototype.
(x86_arch_disable_breakpoint): Add prototype.
* backend/server/i386-arch.c
(do_enable): Renamed into x86_arch_enable_breakpoint().
(do_disable): Renamed into x86_arch_disable_breakpoint().
* backend/server/x86_64-arch.c
(do_enable): Renamed into x86_arch_enable_breakpoint().
(do_disable): Renamed into x86_arch_disable_breakpoint().
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2007-12-08 14:30:34 UTC (rev 90992)
+++ trunk/debugger/ChangeLog 2007-12-08 15:46:59 UTC (rev 90993)
@@ -1,5 +1,51 @@
2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
+ * configure.in: Bumped version number to 0.60.
+
+2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
+
+ Changed default behavior: don't follow fork() by default.
+
+ * classes/DebuggerConfiguration.cs
+ (DebuggerConfiguration.FollowFork): Changed default to false.
+
+ * test/testsuite/NUnit.cs
+ (NUnitInterpreter.ctor): Override configuration: enable `FollowFork'.
+
+2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
+
+ * frontend/Command.cs
+ (ConfigCommand): New command.
+
+2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
+
+ * backend/Inferior.cs
+ (Inferior): Replaced InitializeAfterFork() by DetachAfterFork().
+
+ * backend/SingleSteppingEngine.cs
+ (SSE.InitAfterFork): New method.
+ (OperationInitializeAfterFork): New operation. To avoid a race
+ condition, we need to wait until the target stopped the first time
+ before we can disable the local breakpoints.
+
+ * backend/server/server.h
+ (mono_debugger_server_init_after_fork): Renamed info
+ mono_debugger_server_detach_after_fork().
+
+ * backend/server/x86-arch.h
+ (x86_arch_enable_breakpoint): Add prototype.
+ (x86_arch_disable_breakpoint): Add prototype.
+
+ * backend/server/i386-arch.c
+ (do_enable): Renamed into x86_arch_enable_breakpoint().
+ (do_disable): Renamed into x86_arch_disable_breakpoint().
+
+ * backend/server/x86_64-arch.c
+ (do_enable): Renamed into x86_arch_enable_breakpoint().
+ (do_disable): Renamed into x86_arch_disable_breakpoint().
+
+2007-12-08 Martin Baulig <[EMAIL PROTECTED]>
+
* backend/ProcessServant.cs
(ProcessServant.ChildForked): Implement detach-after-fork, ie. not
following fork(). At the moment, this can only be enabled in the
Modified: trunk/debugger/backend/Inferior.cs
===================================================================
--- trunk/debugger/backend/Inferior.cs 2007-12-08 14:30:34 UTC (rev 90992)
+++ trunk/debugger/backend/Inferior.cs 2007-12-08 15:46:59 UTC (rev 90993)
@@ -168,7 +168,7 @@
static extern TargetError mono_debugger_server_get_application
(IntPtr handle, out string exe_file, out string cwd, out int nargs, out IntPtr
data);
[DllImport("monodebuggerserver")]
- static extern TargetError mono_debugger_server_init_after_fork
(IntPtr handle, bool follow_fork);
+ static extern TargetError
mono_debugger_server_detach_after_fork (IntPtr handle);
[DllImport("monodebuggerserver")]
static extern TargetError mono_debugger_server_push_registers
(IntPtr handle, out long new_rsp);
@@ -1284,11 +1284,10 @@
}
}
- public void InitializeAfterFork (bool follow_fork)
+ public void DetachAfterFork ()
{
- check_error (mono_debugger_server_init_after_fork
(server_handle, follow_fork));
- if (follow_fork)
- breakpoint_manager.InitializeAfterFork (this);
+ mono_debugger_server_detach_after_fork (server_handle);
+ Dispose ();
}
public TargetAddress PushRegisters ()
@@ -1381,16 +1380,27 @@
{
check_disposed ();
ServerStackFrame frame;
- TargetError result = mono_debugger_server_get_frame (
- server_handle, out frame);
+ TargetError result = mono_debugger_server_get_frame
(server_handle, out frame);
check_error (result);
return frame;
}
+ public StackFrame GetCurrentFrame (bool may_fail)
+ {
+ check_disposed ();
+ ServerStackFrame frame;
+ TargetError result = mono_debugger_server_get_frame
(server_handle, out frame);
+ if (result == TargetError.None)
+ return new StackFrame (target_info, frame);
+ else if (may_fail)
+ return null;
+ else
+ throw new TargetException (result);
+ }
+
public StackFrame GetCurrentFrame ()
{
- ServerStackFrame frame = get_current_frame ();
- return new StackFrame (target_info, frame);
+ return GetCurrentFrame (false);
}
public TargetMemoryArea[] GetMemoryMaps ()
Modified: trunk/debugger/backend/ProcessServant.cs
===================================================================
--- trunk/debugger/backend/ProcessServant.cs 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/backend/ProcessServant.cs 2007-12-08 15:46:59 UTC (rev
90993)
@@ -200,9 +200,8 @@
manager, new_process, new_process.ProcessStart);
new_inferior.InitializeThread (pid);
- new_inferior.InitializeAfterFork
(manager.Debugger.Configuration.FollowFork);
if (!manager.Debugger.Configuration.FollowFork) {
- new_inferior.Detach ();
+ new_inferior.DetachAfterFork ();
return;
}
@@ -216,7 +215,7 @@
// Order is important: first add the new engine to the
manager's hash table,
// then call inferior.Initialize()
/ inferior.Attach().
manager.AddEngine (new_thread);
- new_thread.StartThread (false);
+ new_thread.InitAfterFork ();
manager.Debugger.OnProcessCreatedEvent (new_process);
new_process.OnThreadCreatedEvent (new_thread);
Modified: trunk/debugger/backend/SingleSteppingEngine.cs
===================================================================
--- trunk/debugger/backend/SingleSteppingEngine.cs 2007-12-08 14:30:34 UTC
(rev 90992)
+++ trunk/debugger/backend/SingleSteppingEngine.cs 2007-12-08 15:46:59 UTC
(rev 90993)
@@ -127,6 +127,13 @@
return result;
}
+ internal void InitAfterFork ()
+ {
+ CommandResult result = new ThreadCommandResult (thread);
+ current_operation = new OperationRun (this, result);
+ PushOperation (new OperationInitAfterFork (this));
+ }
+
#region child event processing
// <summary>
// This is called from the SingleSteppingEngine's main event
loop to give
@@ -967,8 +974,8 @@
"{0} throwing exception {1} at {2} while
running {3}", this, exc, ip,
current_operation);
- if ((current_operation != null) &&
!current_operation.StartFrame.IsNull &&
- current_operation.StartFrame == ip)
+ if ((current_operation != null) &&
(current_operation.StartFrame != null) &&
+ (current_operation.StartFrame.Address == ip))
return false;
if (current_operation is OperationRuntimeInvoke)
@@ -1974,7 +1981,7 @@
protected readonly Inferior inferior;
public readonly CommandResult Result;
- public TargetAddress StartFrame = TargetAddress.Null;
+ public Inferior.StackFrame StartFrame;
public int PendingBreakpoint = -1;
protected Operation (SingleSteppingEngine sse, CommandResult
result)
@@ -1990,7 +1997,7 @@
public virtual void Execute ()
{
- StartFrame = inferior.CurrentFrame;
+ StartFrame = inferior.GetCurrentFrame (true);
Report.Debug (DebugFlags.SSE, "{0} executing {1} at
{2}",
sse, this, StartFrame);
DoExecute ();
@@ -2344,6 +2351,33 @@
}
}
+ protected class OperationInitAfterFork : Operation
+ {
+ public OperationInitAfterFork (SingleSteppingEngine sse)
+ : base (sse, null)
+ { }
+
+ public override bool IsSourceOperation {
+ get { return false; }
+ }
+
+ protected override void DoExecute ()
+ { }
+
+ protected override EventResult DoProcessEvent
(Inferior.ChildEvent cevent,
+ out
TargetEventArgs args)
+ {
+ Report.Debug (DebugFlags.SSE,
+ "{0} init after fork ({1})", sse,
+ DebuggerWaitHandle.CurrentThread);
+
+
sse.ProcessServant.BreakpointManager.InitializeAfterFork (inferior);
+
+ args = null;
+ return EventResult.AskParent;
+ }
+ }
+
protected class OperationGetLMFAddr : OperationCallback
{
public OperationGetLMFAddr (SingleSteppingEngine sse,
CommandResult result)
Modified: trunk/debugger/backend/server/i386-arch.c
===================================================================
--- trunk/debugger/backend/server/i386-arch.c 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/backend/server/i386-arch.c 2007-12-08 15:46:59 UTC (rev
90993)
@@ -745,7 +745,7 @@
}
static ServerCommandError
-do_enable (ServerHandle *handle, BreakpointInfo *breakpoint)
+x86_arch_enable_breakpoint (ServerHandle *handle, BreakpointInfo *breakpoint)
{
ServerCommandError result;
ArchInfo *arch = handle->arch;
@@ -795,7 +795,7 @@
}
static ServerCommandError
-do_disable (ServerHandle *handle, BreakpointInfo *breakpoint)
+x86_arch_disable_breakpoint (ServerHandle *handle, BreakpointInfo *breakpoint)
{
ServerCommandError result;
ArchInfo *arch = handle->arch;
@@ -868,7 +868,7 @@
breakpoint->id = mono_debugger_breakpoint_manager_get_next_id ();
breakpoint->dr_index = -1;
- result = do_enable (handle, breakpoint);
+ result = x86_arch_enable_breakpoint (handle, breakpoint);
if (result != COMMAND_ERROR_NONE) {
mono_debugger_breakpoint_manager_unlock ();
g_free (breakpoint);
@@ -902,7 +902,7 @@
goto out;
}
- result = do_disable (handle, breakpoint);
+ result = x86_arch_disable_breakpoint (handle, breakpoint);
if (result != COMMAND_ERROR_NONE)
goto out;
@@ -930,26 +930,6 @@
}
static ServerCommandError
-server_ptrace_init_after_fork (ServerHandle *handle, gboolean follow_fork)
-{
- GPtrArray *breakpoints;
- int i;
-
- mono_debugger_breakpoint_manager_lock ();
-
- breakpoints = mono_debugger_breakpoint_manager_get_breakpoints
(handle->bpm);
- for (i = 0; i < breakpoints->len; i++) {
- BreakpointInfo *info = g_ptr_array_index (breakpoints, i);
-
- if (!follow_fork || (info->dr_index >= 0))
- do_disable (handle, info);
- }
-
- mono_debugger_breakpoint_manager_unlock ();
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
find_free_hw_register (ServerHandle *handle, guint32 *idx)
{
int i;
@@ -992,7 +972,7 @@
breakpoint->is_hardware_bpt = TRUE;
breakpoint->dr_index = *idx;
- result = do_enable (handle, breakpoint);
+ result = x86_arch_enable_breakpoint (handle, breakpoint);
if (result != COMMAND_ERROR_NONE) {
mono_debugger_breakpoint_manager_unlock ();
g_free (breakpoint);
@@ -1021,7 +1001,7 @@
return COMMAND_ERROR_NO_SUCH_BREAKPOINT;
}
- result = do_enable (handle, breakpoint);
+ result = x86_arch_enable_breakpoint (handle, breakpoint);
breakpoint->enabled = TRUE;
mono_debugger_breakpoint_manager_unlock ();
return result;
@@ -1040,7 +1020,7 @@
return COMMAND_ERROR_NO_SUCH_BREAKPOINT;
}
- result = do_disable (handle, breakpoint);
+ result = x86_arch_disable_breakpoint (handle, breakpoint);
breakpoint->enabled = FALSE;
mono_debugger_breakpoint_manager_unlock ();
return result;
Modified: trunk/debugger/backend/server/library.c
===================================================================
--- trunk/debugger/backend/server/library.c 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/backend/server/library.c 2007-12-08 15:46:59 UTC (rev
90993)
@@ -413,12 +413,12 @@
}
ServerCommandError
-mono_debugger_server_init_after_fork (ServerHandle *handle, gboolean
follow_fork)
+mono_debugger_server_detach_after_fork (ServerHandle *handle)
{
- if (!global_vtable->init_after_fork)
+ if (!global_vtable->detach_after_fork)
return COMMAND_ERROR_NOT_IMPLEMENTED;
- return (* global_vtable->init_after_fork) (handle, follow_fork);
+ return (* global_vtable->detach_after_fork) (handle);
}
ServerCommandError
Modified: trunk/debugger/backend/server/server.h
===================================================================
--- trunk/debugger/backend/server/server.h 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/backend/server/server.h 2007-12-08 15:46:59 UTC (rev
90993)
@@ -358,8 +358,7 @@
guint32 *nargs,
gchar
***cmdline_args);
- ServerCommandError (* init_after_fork) (ServerHandle
*handle,
- gboolean
follow_fork);
+ ServerCommandError (* detach_after_fork) (ServerHandle
*handle);
ServerCommandError (* push_registers) (ServerHandle
*handle,
guint64
*new_rsp);
@@ -580,8 +579,7 @@
gchar ***cmdline_args);
ServerCommandError
-mono_debugger_server_init_after_fork (ServerHandle *handle,
- gboolean follow_fork);
+mono_debugger_server_detach_after_fork (ServerHandle *handle);
ServerCommandError
mono_debugger_server_push_registers (ServerHandle *handle,
Modified: trunk/debugger/backend/server/x86-arch.h
===================================================================
--- trunk/debugger/backend/server/x86-arch.h 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/backend/server/x86-arch.h 2007-12-08 15:46:59 UTC (rev
90993)
@@ -73,8 +73,11 @@
x86_arch_get_registers (ServerHandle *handle);
static ServerCommandError
-server_ptrace_init_after_fork (ServerHandle *handle, gboolean follow_fork);
+x86_arch_disable_breakpoint (ServerHandle *handle, BreakpointInfo *breakpoint);
+static ServerCommandError
+x86_arch_enable_breakpoint (ServerHandle *handle, BreakpointInfo *breakpoint);
+
#if defined(__i386__)
#include "i386-arch.h"
#elif defined(__x86_64__)
Modified: trunk/debugger/backend/server/x86-linux-ptrace.c
===================================================================
--- trunk/debugger/backend/server/x86-linux-ptrace.c 2007-12-08 14:30:34 UTC
(rev 90992)
+++ trunk/debugger/backend/server/x86-linux-ptrace.c 2007-12-08 15:46:59 UTC
(rev 90993)
@@ -455,3 +455,29 @@
g_ptr_array_free (array, FALSE);
return COMMAND_ERROR_NONE;
}
+
+static ServerCommandError
+server_ptrace_detach_after_fork (ServerHandle *handle)
+{
+ GPtrArray *breakpoints;
+ guint32 status;
+ int i;
+
+ do_wait (handle->inferior->pid, &status);
+
+ mono_debugger_breakpoint_manager_lock ();
+
+ breakpoints = mono_debugger_breakpoint_manager_get_breakpoints
(handle->bpm);
+ for (i = 0; i < breakpoints->len; i++) {
+ BreakpointInfo *info = g_ptr_array_index (breakpoints, i);
+
+ x86_arch_disable_breakpoint (handle, info);
+ }
+
+ mono_debugger_breakpoint_manager_unlock ();
+
+ if (ptrace (PT_DETACH, handle->inferior->pid, NULL, NULL) != 0)
+ return _server_ptrace_check_errno (handle->inferior);
+
+ return COMMAND_ERROR_NONE;
+}
Modified: trunk/debugger/backend/server/x86-ptrace.c
===================================================================
--- trunk/debugger/backend/server/x86-ptrace.c 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/backend/server/x86-ptrace.c 2007-12-08 15:46:59 UTC (rev
90993)
@@ -585,7 +585,7 @@
server_ptrace_get_signal_info,
server_ptrace_get_threads,
server_ptrace_get_application,
- server_ptrace_init_after_fork,
+ server_ptrace_detach_after_fork,
server_ptrace_push_registers,
server_ptrace_pop_registers,
server_ptrace_get_callback_frame
Modified: trunk/debugger/backend/server/x86_64-arch.c
===================================================================
--- trunk/debugger/backend/server/x86_64-arch.c 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/backend/server/x86_64-arch.c 2007-12-08 15:46:59 UTC (rev
90993)
@@ -521,7 +521,7 @@
}
static ServerCommandError
-do_enable (ServerHandle *handle, BreakpointInfo *breakpoint)
+x86_arch_enable_breakpoint (ServerHandle *handle, BreakpointInfo *breakpoint)
{
ServerCommandError result;
ArchInfo *arch = handle->arch;
@@ -576,7 +576,7 @@
}
static ServerCommandError
-do_disable (ServerHandle *handle, BreakpointInfo *breakpoint)
+x86_arch_disable_breakpoint (ServerHandle *handle, BreakpointInfo *breakpoint)
{
ServerCommandError result;
ArchInfo *arch = handle->arch;
@@ -649,7 +649,7 @@
breakpoint->id = mono_debugger_breakpoint_manager_get_next_id ();
breakpoint->dr_index = -1;
- result = do_enable (handle, breakpoint);
+ result = x86_arch_enable_breakpoint (handle, breakpoint);
if (result != COMMAND_ERROR_NONE) {
mono_debugger_breakpoint_manager_unlock ();
g_free (breakpoint);
@@ -683,7 +683,7 @@
goto out;
}
- result = do_disable (handle, breakpoint);
+ result = x86_arch_disable_breakpoint (handle, breakpoint);
if (result != COMMAND_ERROR_NONE)
goto out;
@@ -696,26 +696,6 @@
}
static ServerCommandError
-server_ptrace_init_after_fork (ServerHandle *handle, gboolean follow_fork)
-{
- GPtrArray *breakpoints;
- int i;
-
- mono_debugger_breakpoint_manager_lock ();
-
- breakpoints = mono_debugger_breakpoint_manager_get_breakpoints
(handle->bpm);
- for (i = 0; i < breakpoints->len; i++) {
- BreakpointInfo *info = g_ptr_array_index (breakpoints, i);
-
- if (!follow_fork || (info->dr_index >= 0))
- do_disable (handle, info);
- }
-
- mono_debugger_breakpoint_manager_unlock ();
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
find_free_hw_register (ServerHandle *handle, guint32 *idx)
{
int i;
@@ -758,7 +738,7 @@
breakpoint->is_hardware_bpt = TRUE;
breakpoint->dr_index = *idx;
- result = do_enable (handle, breakpoint);
+ result = x86_arch_enable_breakpoint (handle, breakpoint);
if (result != COMMAND_ERROR_NONE) {
mono_debugger_breakpoint_manager_unlock ();
g_free (breakpoint);
@@ -787,7 +767,7 @@
return COMMAND_ERROR_NO_SUCH_BREAKPOINT;
}
- result = do_enable (handle, breakpoint);
+ result = x86_arch_enable_breakpoint (handle, breakpoint);
breakpoint->enabled = TRUE;
mono_debugger_breakpoint_manager_unlock ();
return result;
@@ -806,7 +786,7 @@
return COMMAND_ERROR_NO_SUCH_BREAKPOINT;
}
- result = do_disable (handle, breakpoint);
+ result = x86_arch_disable_breakpoint (handle, breakpoint);
breakpoint->enabled = FALSE;
mono_debugger_breakpoint_manager_unlock ();
return result;
Modified: trunk/debugger/classes/DebuggerConfiguration.cs
===================================================================
--- trunk/debugger/classes/DebuggerConfiguration.cs 2007-12-08 14:30:34 UTC
(rev 90992)
+++ trunk/debugger/classes/DebuggerConfiguration.cs 2007-12-08 15:46:59 UTC
(rev 90993)
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Text;
using System.Reflection;
using System.Collections;
using System.Configuration;
@@ -138,10 +139,10 @@
}
}
- bool stay_in_thread;
+ bool stay_in_thread = false;
bool broken_threading = true;
- bool load_native_symtabs;
- bool follow_fork = true;
+ bool load_native_symtabs = false;
+ bool follow_fork = false;
Hashtable module_groups;
//
@@ -243,5 +244,22 @@
get { return follow_fork; }
set { follow_fork = value; }
}
+
+ public string PrintConfiguration (bool expert_mode)
+ {
+ StringBuilder sb = new StringBuilder ("Debugger
Configuration:\n");
+ sb.Append (String.Format (" Load native symtabs
(native-symtabs): {0}\n",
+ LoadNativeSymtabs ? "yes" :
"no"));
+ sb.Append (String.Format (" Follow fork (follow-fork):
{0}\n",
+ FollowFork ? "yes" : "no"));
+ if (expert_mode) {
+ sb.Append ("\nExpert Settings:\n");
+ sb.Append (String.Format (" Broken threading
(broken-threading): {0}\n",
+ BrokenThreading ?
"enabled" : "disabled"));
+ sb.Append (String.Format (" Stay in thread
(stay-in-thread): {0}\n",
+ BrokenThreading ?
"yes" : "no"));
+ }
+ return sb.ToString ();
+ }
}
}
Modified: trunk/debugger/configure.in
===================================================================
--- trunk/debugger/configure.in 2007-12-08 14:30:34 UTC (rev 90992)
+++ trunk/debugger/configure.in 2007-12-08 15:46:59 UTC (rev 90993)
@@ -2,7 +2,7 @@
AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono-debugger, 0.55)
+AM_INIT_AUTOMAKE(mono-debugger, 0.60)
AM_MAINTAINER_MODE
AC_CHECK_TOOL(CC, gcc, gcc)
Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs 2007-12-08 14:30:34 UTC (rev 90992)
+++ trunk/debugger/frontend/Command.cs 2007-12-08 15:46:59 UTC (rev 90993)
@@ -87,6 +87,7 @@
RegisterCommand ("save", typeof (SaveCommand));
RegisterCommand ("load", typeof (LoadCommand));
RegisterCommand ("module", typeof (ModuleCommand));
+ RegisterCommand ("config", typeof (ConfigCommand));
}
}
@@ -3555,4 +3556,76 @@
public string Description { get { return "Test."; } }
public string Documentation { get { return ""; } }
}
+
+ public class ConfigCommand : DebuggerCommand, IDocumentableCommand
+ {
+ bool expert_mode;
+
+ public bool Expert {
+ get { return expert_mode; }
+ set { expert_mode = value; }
+ }
+
+ protected override bool DoResolve (ScriptingContext context)
+ {
+ DebuggerConfiguration config =
context.Interpreter.DebuggerConfiguration;
+
+ if (Args == null) {
+ context.Print (config.PrintConfiguration
(expert_mode));
+ return true;
+ }
+
+ foreach (string arg in Args) {
+ if ((arg [0] != '+') && (arg [0] != '-'))
+ throw new ScriptingException ("Expected
`+option' or `-option'.");
+
+ bool enable = arg [0] == '+';
+
+ string option = arg.Substring (1);
+ switch (option) {
+ case "native-symtabs":
+ config.LoadNativeSymtabs = enable;
+ break;
+
+ case "follow-fork":
+ config.FollowFork = enable;
+ break;
+
+ case "broken-threading":
+ if (!expert_mode)
+ throw new ScriptingException (
+ "This option is only
available in expert mode.");
+
+ config.BrokenThreading = enable;
+ break;
+
+ case "stay-in-thread":
+ if (!expert_mode)
+ throw new ScriptingException (
+ "This option is only
available in expert mode.");
+
+ config.StayInThread = enable;
+ break;
+
+ default:
+ throw new ScriptingException (
+ "No such configuration option
`{0}'.", option);
+ }
+ }
+
+ config.SaveConfiguration ();
+ context.Print ("Configuration changed.");
+ return true;
+ }
+
+ protected override object DoExecute (ScriptingContext context)
+ {
+ return null;
+ }
+
+ // IDocumentableCommand
+ public CommandFamily Family { get { return
CommandFamily.Support; } }
+ public string Description { get { return "Modify configuration
options."; } }
+ public string Documentation { get { return ""; } }
+ }
}
Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/frontend/Interpreter.cs 2007-12-08 15:46:59 UTC (rev
90993)
@@ -74,9 +74,6 @@
public void Exit ()
{
- if (config != null)
- config.SaveConfiguration ();
-
try {
Dispose ();
} catch (Exception ex) {
Modified: trunk/debugger/test/testsuite/NUnit.cs
===================================================================
--- trunk/debugger/test/testsuite/NUnit.cs 2007-12-08 14:30:34 UTC (rev
90992)
+++ trunk/debugger/test/testsuite/NUnit.cs 2007-12-08 15:46:59 UTC (rev
90993)
@@ -80,6 +80,8 @@
this.inferior_stdout = inferior_stdout;
this.inferior_stderr = inferior_stderr;
+ config.FollowFork = true;
+
queue = Queue.Synchronized (new Queue ());
wait_event = new ST.ManualResetEvent (false);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches