Author: martin
Date: 2007-06-11 09:50:36 -0400 (Mon, 11 Jun 2007)
New Revision: 79179

Modified:
   branches/martin/debugger-dublin/debugger/backend/BreakpointHandle.cs
   branches/martin/debugger-dublin/debugger/backend/SingleSteppingEngine.cs
   branches/martin/debugger-dublin/debugger/classes/DebuggerSession.cs
   branches/martin/debugger-dublin/debugger/classes/MainMethodBreakpoint.cs
   branches/martin/debugger-dublin/debugger/classes/SourceLocation.cs
   branches/martin/debugger-dublin/debugger/languages/mono/MonoClassType.cs
   branches/martin/debugger-dublin/debugger/languages/mono/MonoFunctionType.cs
   
branches/martin/debugger-dublin/debugger/languages/mono/MonoLanguageBackend.cs
Log:
Code cleanups; remove debugging code.

Modified: branches/martin/debugger-dublin/debugger/backend/BreakpointHandle.cs
===================================================================
--- branches/martin/debugger-dublin/debugger/backend/BreakpointHandle.cs        
2007-06-11 13:48:04 UTC (rev 79178)
+++ branches/martin/debugger-dublin/debugger/backend/BreakpointHandle.cs        
2007-06-11 13:50:36 UTC (rev 79179)
@@ -117,8 +117,6 @@
 
                internal void MethodLoaded (TargetMemoryAccess target, Method 
method)
                {
-                       Console.WriteLine ("BREAKPOINT HANDLE LOADED: {0}", 
method);
-
                        TargetAddress address;
                        if (line != -1) {
                                if (method.HasLineNumbers)

Modified: 
branches/martin/debugger-dublin/debugger/backend/SingleSteppingEngine.cs
===================================================================
--- branches/martin/debugger-dublin/debugger/backend/SingleSteppingEngine.cs    
2007-06-11 13:48:04 UTC (rev 79178)
+++ branches/martin/debugger-dublin/debugger/backend/SingleSteppingEngine.cs    
2007-06-11 13:50:36 UTC (rev 79179)
@@ -522,7 +522,7 @@
 
                internal void ReachedManagedMain (TargetAddress method)
                {
-                       process.MonoLanguage.ReachedMain (inferior, method);
+                       // process.MonoLanguage.ReachedMain (inferior, method);
                        // TargetAddress compile = 
process.MonoLanguage.CompileMethodFunc;
                        // PushOperation (new OperationCompileMethod (this, 
compile, method, null));
                        PushOperation (new OperationManagedMain (this, method));
@@ -2112,15 +2112,10 @@
 
                protected override bool CallbackCompleted (long data1, long 
data2)
                {
-                       Console.WriteLine ("INSERT METHOD BREAKPOINT: {0:x} 
{1:x}", data1, data2);
                        if (!class_resolved) {
                                TargetAddress klass = new TargetAddress 
(inferior.AddressDomain, data1);
-                               Console.WriteLine ("RESOLVE CLASS #1: {0}", 
klass);
                                MonoClassInfo info = 
Function.MonoClass.ClassResolved (sse.Client, klass);
-                               Console.WriteLine ("RESOLVE CLASS #2: {0}", 
info);
-
                                TargetAddress method = info.GetMethodAddress 
(Function.Token);
-                               Console.WriteLine ("GET METHOD ADDRESS OR BPT: 
{0}", method);
 
                                index = MonoLanguageBackend.GetUniqueID ();
 
@@ -2172,7 +2167,6 @@
 
                StackFrame main_frame;
                bool completed;
-               bool has_main;
 
                bool do_execute ()
                {
@@ -2180,27 +2174,13 @@
                                      "{0} managed main execute: {1} {2}", sse,
                                      inferior.CurrentFrame, 
pending_events.Count);
 
-                       Console.WriteLine ("MANAGED MAIN: {0} {1} {2}", sse,
-                                          inferior.CurrentFrame, MainMethod);
+                       MonoLanguageBackend mono = 
sse.ProcessServant.MonoLanguage;
 
-                       int token = inferior.ReadInteger (MainMethod + 4);
-                       TargetAddress klass = inferior.ReadAddress (MainMethod 
+ 8);
-                       TargetAddress image = inferior.ReadAddress (klass);
-
-                       Console.WriteLine ("MANAGED MAIN #1: {0:x} {1} {2}", 
token, klass, image);
-
-                       MonoSymbolFile file = 
sse.ProcessServant.MonoLanguage.GetImage (image);
-
-                       Console.WriteLine ("MANAGED MAIN #2: {0}", file);
-
-                       MethodSource source = file.GetMethodByToken (token);
+                       MethodSource source = mono.ReachedMain (inferior, 
MainMethod);
                        SourceLocation location = new SourceLocation (source);
 
-                       Method method = file.GetMonoMethod (source, token);
+                       Method method = source.GetMethod (0);
 
-                       Console.WriteLine ("MANAGED MAIN #3: {0} {1}", method,
-                                          sse.start.Options.StopInMain);
-
                        Inferior.StackFrame iframe = inferior.GetCurrentFrame 
();
                        Registers registers = inferior.GetRegisters ();
 
@@ -2209,29 +2189,11 @@
                                iframe.FrameAddress, registers, method, 
location);
                        sse.update_current_frame (main_frame);
 
-#if FIXME
-                       if (!has_main && sse.start.Options.StopInMain) {
-                               has_main = true;
-                               sse.PushOperation (new 
OperationMethodBreakpoint (
-                                       sse, source.Function, main_loaded));
-                               return true;
-
-#if FIXME
-                               Breakpoint main_bpt = new MainMethodBreakpoint 
(source.Function);
-                               if (activate_breakpoint (main_bpt))
-                                       return true;
-#endif
-                       }
-#endif
-
                        while (pending_events.Count > 0) {
                                Event e = (Event) pending_events.Dequeue ();
                                Report.Debug (DebugFlags.SSE,
                                              "{0} managed main: {1}", sse, e);
 
-                               Console.WriteLine ("MANAGED MAIN #5: {0} {1} 
{2} {3}", sse,
-                                                  sse.CurrentFrame, 
sse.Client.CurrentFrame, e);
-
                                if (!e.IsEnabled)
                                        continue;
 
@@ -2256,11 +2218,7 @@
 
                bool activate_breakpoint (Breakpoint breakpoint)
                {
-                       Console.WriteLine ("MANAGED MAIN #5: {0} {1} {2} {3}", 
sse,
-                                          sse.CurrentFrame, 
sse.Client.CurrentFrame, breakpoint);
-
                        BreakpointHandle handle = breakpoint.Resolve (sse, 
main_frame);
-                       Console.WriteLine ("MANAGED MAIN #6: {0}", handle);
                        if (handle == null)
                                return false;
 
@@ -2275,19 +2233,6 @@
                        return true;
                }
 
-               void main_loaded (TargetMemoryAccess target, Method method)
-               {
-                       Console.WriteLine ("MAIN LOADED: {0}", method);
-
-                       TargetAddress address = method.HasMethodBounds ?
-                               method.MethodStartAddress : method.StartAddress;
-
-                       sse.insert_temporary_breakpoint (address);
-
-                       // int index = inferior.InsertBreakpoint (address);
-                       // Console.WriteLine ("MAIN LOADED #1: {0} {1}", index, 
address);
-               }
-
                Queue pending_events;
 
                protected override EventResult DoProcessEvent 
(Inferior.ChildEvent cevent,
@@ -2297,9 +2242,6 @@
                                      "{0} managed main: {1} {2}", sse, cevent,
                                      inferior.CurrentFrame);
 
-                       Console.WriteLine ("MANAGED MAIN PROCESS EVENT: {0} {1} 
{2}", sse,
-                                          inferior.CurrentFrame, cevent);
-
                        args = null;
                        if (completed)
                                return EventResult.Completed;

Modified: branches/martin/debugger-dublin/debugger/classes/DebuggerSession.cs
===================================================================
--- branches/martin/debugger-dublin/debugger/classes/DebuggerSession.cs 
2007-06-11 13:48:04 UTC (rev 79178)
+++ branches/martin/debugger-dublin/debugger/classes/DebuggerSession.cs 
2007-06-11 13:50:36 UTC (rev 79179)
@@ -71,7 +71,8 @@
                {
                        this.Options = options;
 
-                       BreakInMain ();
+                       if (Options.StopInMain)
+                               AddEvent (new MainMethodBreakpoint (this));
                }
 
                internal DebuggerSession Clone (DebuggerOptions new_options, 
string new_name)
@@ -219,13 +220,6 @@
                        return main_process.FindFile (name);
                }
 
-               public void BreakInMain ()
-               {
-                       Console.WriteLine ("BREAK IN MAIN!");
-                       Event handle = new MainMethodBreakpoint (this);
-                       AddEvent (handle);
-               }
-
                //
                // Session management.
                //

Modified: 
branches/martin/debugger-dublin/debugger/classes/MainMethodBreakpoint.cs
===================================================================
--- branches/martin/debugger-dublin/debugger/classes/MainMethodBreakpoint.cs    
2007-06-11 13:48:04 UTC (rev 79178)
+++ branches/martin/debugger-dublin/debugger/classes/MainMethodBreakpoint.cs    
2007-06-11 13:50:36 UTC (rev 79179)
@@ -28,8 +28,6 @@
                        if (handle != null)
                                return handle;
 
-                       Console.WriteLine ("RESOLVE MAIN BREAKPOINT: {0}", 
frame);
-
                        if (frame.Thread.Process.IsManaged) {
                                MonoLanguageBackend mono = 
frame.Thread.Process.Servant.MonoLanguage;
                                MethodSource main = mono.MainMethod;

Modified: branches/martin/debugger-dublin/debugger/classes/SourceLocation.cs
===================================================================
--- branches/martin/debugger-dublin/debugger/classes/SourceLocation.cs  
2007-06-11 13:48:04 UTC (rev 79178)
+++ branches/martin/debugger-dublin/debugger/classes/SourceLocation.cs  
2007-06-11 13:50:36 UTC (rev 79179)
@@ -247,9 +247,6 @@
                        if (!module.IsLoaded)
                                return new ModuleBreakpointHandle (breakpoint, 
module);
 
-                       Console.WriteLine ("RESOLVE BREAKPOINT: {0} {1} {2}", 
breakpoint,
-                                          function, source);
-
                        if ((function == null) && (source == null)) {
                                if (method != null) {
                                        source = module.FindMethod (method);

Modified: 
branches/martin/debugger-dublin/debugger/languages/mono/MonoClassType.cs
===================================================================
--- branches/martin/debugger-dublin/debugger/languages/mono/MonoClassType.cs    
2007-06-11 13:48:04 UTC (rev 79178)
+++ branches/martin/debugger-dublin/debugger/languages/mono/MonoClassType.cs    
2007-06-11 13:50:36 UTC (rev 79179)
@@ -625,8 +625,6 @@
 
                internal bool ResolveClass (Thread target)
                {
-                       Console.WriteLine ("RESOLVE CLASS: {0}", type_info);
-
                        if (type_info != null)
                                return true;
 
@@ -634,9 +632,7 @@
                                file.MonoLanguage.MonoDebuggerInfo.LookupClass,
                                file.MonoImage, 0, Name);
 
-                       Console.WriteLine ("RESOLVE CLASS #1: {0}", 
klass_address);
                        type_info = file.MonoLanguage.GetClassInfo (target, 
klass_address);
-                       Console.WriteLine ("RESOLVE CLASS #2: {0} {1}", 
klass_address, type_info);
                        return type_info != null;
                }
        }

Modified: 
branches/martin/debugger-dublin/debugger/languages/mono/MonoFunctionType.cs
===================================================================
--- branches/martin/debugger-dublin/debugger/languages/mono/MonoFunctionType.cs 
2007-06-11 13:48:04 UTC (rev 79178)
+++ branches/martin/debugger-dublin/debugger/languages/mono/MonoFunctionType.cs 
2007-06-11 13:50:36 UTC (rev 79179)
@@ -171,13 +171,10 @@
                                throw new InternalError ();
 
                        TargetAddress method = 
klass.MonoClassInfo.GetMethodAddress (Token);
-                       Console.WriteLine ("GET METHOD ADDRESS OR BPT: {0}", 
method);
 
                        load_handler = 
klass.File.MonoLanguage.RegisterMethodLoadHandler (
                                target, method, handler);
 
-                       Console.WriteLine ("GET METHOD ADDRESS OR BPT #1: {0}", 
load_handler);
-
                        return load_handler > 0;
                }
 

Modified: 
branches/martin/debugger-dublin/debugger/languages/mono/MonoLanguageBackend.cs
===================================================================
--- 
branches/martin/debugger-dublin/debugger/languages/mono/MonoLanguageBackend.cs  
    2007-06-11 13:48:04 UTC (rev 79178)
+++ 
branches/martin/debugger-dublin/debugger/languages/mono/MonoLanguageBackend.cs  
    2007-06-11 13:50:36 UTC (rev 79179)
@@ -367,7 +367,7 @@
                        initialized = true;
                }
 
-               internal void ReachedMain (TargetMemoryAccess target, 
TargetAddress method)
+               internal MethodSource ReachedMain (TargetMemoryAccess target, 
TargetAddress method)
                {
                        int token = target.ReadInteger (method + 4);
                        TargetAddress klass = target.ReadAddress (method + 8);
@@ -380,6 +380,8 @@
                        main_method = file.GetMethodByToken (token);
                        if (main_method == null)
                                throw new InternalError ();
+
+                       return main_method;
                }
 
                internal MethodSource MainMethod {
@@ -705,8 +707,6 @@
                                info.RegisterClassInitCallback,
                                klass.File.MonoImage, index, klass.Name);
 
-                       Console.WriteLine ("TEST #1: {0} {1} {2}", klass, 
index, retval);
-
                        if (retval.IsNull) {
                                class_init_handlers.Add (index, handler);
                                return index;
@@ -723,34 +723,7 @@
 
                Method method_from_jit_info (TargetMemoryAccess target, 
TargetAddress data)
                {
-                       Console.WriteLine ("JIT INFO: {0}", data);
-
-                       Method the_method = process.SymbolTableManager.Lookup 
(data);
-
-                       Console.WriteLine ("JIT INFO #1: {0}", data, 
the_method);
-
-                       return the_method;
-
-                       try {
-                               TargetBinaryReader reader = target.ReadMemory 
(data, 16).GetReader ();
-                               int size = reader.ReadInt32 ();
-                               int symfile_id = reader.ReadInt32 ();
-                               int domain_id = reader.ReadInt32 ();
-                               int method_id = reader.ReadInt32 ();
-
-                               MonoSymbolFile file = (MonoSymbolFile) 
symbol_files [symfile_id];
-                               if (file == null)
-                                       return null;
-
-                               Console.WriteLine ("JIT INFO #1: {0} {1} {2} 
{3} {4}", size,
-                                                  symfile_id, domain_id, 
method_id, file);
-
-                               Method method = file.GetMethod (domain_id, 
method_id);
-                               Console.WriteLine ("JIT INFO #2: {0}", method);
-                               return method;
-                       } catch (TargetException) {
-                               return null;
-                       }
+                       return process.SymbolTableManager.Lookup (data);
                }
 
                internal int RegisterMethodLoadHandler (Thread target, 
TargetAddress method_address,
@@ -761,8 +734,6 @@
                        TargetAddress retval = target.CallMethod (
                                info.GetMethodAddressOrBpt, method_address, 
index);
 
-                       Console.WriteLine ("METHOD LOAD HANDLER: {0} {1}", 
method_address, retval);
-
                        if (retval.IsNull) {
                                method_load_handlers.Add (index, handler);
                                return index;
@@ -1032,10 +1003,7 @@
 
                void JitBreakpoint (Inferior inferior, int idx, TargetAddress 
data)
                {
-                       Console.WriteLine ("JIT BREAKPOINT: {0} {1}", idx, 
data);
-
                        Method method = method_from_jit_info (inferior, data);
-                       Console.WriteLine ("JIT BREAKPOINT #1: {0} {1} {2}", 
idx, data, method);
                        if (method == null)
                                return;
 
@@ -1067,7 +1035,6 @@
                                break;
 
                        case NotificationType.MethodCompiled: {
-                               Console.WriteLine ("METHOD COMPILED: {0} 
{1:x}", data, arg);
                                do_update_symbol_table (inferior);
                                break;
                        }

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

Reply via email to