~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/core/Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// DebuggerSession.cs
 
2
//
 
3
// Author:
 
4
//   Ankit Jain <jankit@novell.com>
 
5
//   Lluis Sanchez Gual <lluis@novell.com>
 
6
//
 
7
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
 
8
//
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
//
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
//
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
//
 
27
//
 
28
 
 
29
 
 
30
using System;
 
31
using System.Collections.Generic;
 
32
using Mono.Debugging.Backend;
 
33
using System.Diagnostics;
 
34
 
 
35
namespace Mono.Debugging.Client
 
36
{
 
37
        public delegate void TargetEventHandler (object sender, TargetEventArgs args);
 
38
        public delegate void ProcessEventHandler(int process_id);
 
39
        public delegate void ThreadEventHandler(int thread_id);
 
40
        
 
41
        public abstract class DebuggerSession: IDisposable
 
42
        {
 
43
                InternalDebuggerSession frontend;
 
44
                Dictionary<BreakEvent,object> breakpoints = new Dictionary<BreakEvent,object> ();
 
45
                bool isRunning;
 
46
                bool started;
 
47
                BreakpointStore breakpointStore;
 
48
                OutputWriterDelegate outputWriter;
 
49
                OutputWriterDelegate logWriter;
 
50
                bool disposed;
 
51
                bool attached;
 
52
                object slock = new object ();
 
53
                object olock = new object ();
 
54
                ThreadInfo activeThread;
 
55
                BreakEventHitHandler customBreakpointHitHandler;
 
56
                
 
57
                ProcessInfo[] currentProcesses;
 
58
                
 
59
                public event EventHandler<TargetEventArgs> TargetEvent;
 
60
                
 
61
                public event EventHandler TargetStarted;
 
62
                public event EventHandler<TargetEventArgs> TargetStopped;
 
63
                public event EventHandler<TargetEventArgs> TargetInterrupted;
 
64
                public event EventHandler<TargetEventArgs> TargetHitBreakpoint;
 
65
                public event EventHandler<TargetEventArgs> TargetSignaled;
 
66
                public event EventHandler TargetExited;
 
67
                public event EventHandler<TargetEventArgs> TargetExceptionThrown;
 
68
                public event EventHandler<TargetEventArgs> TargetUnhandledException;
 
69
                
 
70
                public DebuggerSession ()
 
71
                {
 
72
                        frontend = new InternalDebuggerSession (this);
 
73
                }
 
74
                
 
75
                public void Initialize ()
 
76
                {
 
77
                }
 
78
                
 
79
                public virtual void Dispose ()
 
80
                {
 
81
                        lock (slock) {
 
82
                                if (!disposed) {
 
83
                                        disposed = true;
 
84
                                        Breakpoints = null;
 
85
                                }
 
86
                        }
 
87
                }
 
88
 
 
89
                public BreakpointStore Breakpoints {
 
90
                        get {
 
91
                                lock (slock) {
 
92
                                        if (breakpointStore == null)
 
93
                                                Breakpoints = new BreakpointStore ();
 
94
                                        return breakpointStore;
 
95
                                }
 
96
                        }
 
97
                        set {
 
98
                                lock (slock) {
 
99
                                        if (breakpointStore != null) {
 
100
                                                if (started) {
 
101
                                                        foreach (BreakEvent bp in breakpointStore)
 
102
                                                                RemoveBreakEvent (bp);
 
103
                                                }
 
104
                                                breakpointStore.BreakEventAdded -= OnBreakpointAdded;
 
105
                                                breakpointStore.BreakEventRemoved -= OnBreakpointRemoved;
 
106
                                                breakpointStore.BreakEventModified -= OnBreakpointModified;
 
107
                                                breakpointStore.BreakEventEnableStatusChanged -= OnBreakpointStatusChanged;
 
108
                                        }
 
109
                                        
 
110
                                        breakpointStore = value;
 
111
                                        
 
112
                                        if (breakpointStore != null) {
 
113
                                                if (started) {
 
114
                                                        foreach (BreakEvent bp in breakpointStore)
 
115
                                                                AddBreakEvent (bp);
 
116
                                                }
 
117
                                                breakpointStore.BreakEventAdded += OnBreakpointAdded;
 
118
                                                breakpointStore.BreakEventRemoved += OnBreakpointRemoved;
 
119
                                                breakpointStore.BreakEventModified += OnBreakpointModified;
 
120
                                                breakpointStore.BreakEventEnableStatusChanged += OnBreakpointStatusChanged;
 
121
                                        }
 
122
                                }
 
123
                        }
 
124
                }
 
125
 
 
126
                public BreakEventHitHandler CustomBreakEventHitHandler {
 
127
                        get {
 
128
                                return customBreakpointHitHandler;
 
129
                        }
 
130
                        set {
 
131
                                customBreakpointHitHandler = value;
 
132
                        }
 
133
                }
 
134
                
 
135
                public void Run (DebuggerStartInfo startInfo)
 
136
                {
 
137
                        lock (slock) {
 
138
                                OnRunning ();
 
139
                                try {
 
140
                                        OnRun (startInfo);
 
141
                                } catch {
 
142
                                        ForceStop ();
 
143
                                        throw;
 
144
                                }
 
145
                        }
 
146
                }
 
147
                
 
148
                public void AttachToProcess (ProcessInfo proc)
 
149
                {
 
150
                        lock (slock) {
 
151
                                OnRunning ();
 
152
                                try {
 
153
                                        OnAttachToProcess (proc.Id);
 
154
                                        attached = true;
 
155
                                } catch {
 
156
                                        ForceStop ();
 
157
                                        throw;
 
158
                                }
 
159
                        }
 
160
                }
 
161
                
 
162
                public void Detach ()
 
163
                {
 
164
                        lock (slock) {
 
165
                                OnDetach ();
 
166
                        }
 
167
                }
 
168
                
 
169
                public bool AttachedToProcess {
 
170
                        get {
 
171
                                lock (slock) {
 
172
                                        return attached; 
 
173
                                }
 
174
                        }
 
175
                }
 
176
                
 
177
                public ThreadInfo ActiveThread {
 
178
                        get {
 
179
                                lock (slock) {
 
180
                                        return activeThread;
 
181
                                }
 
182
                        }
 
183
                        set {
 
184
                                lock (slock) {
 
185
                                        activeThread = value;
 
186
                                        OnSetActiveThread (activeThread.ProcessId, activeThread.Id);
 
187
                                }
 
188
                        }
 
189
                }
 
190
                
 
191
                public void NextLine ()
 
192
                {
 
193
                        lock (slock) {
 
194
                                OnRunning ();
 
195
                                try {
 
196
                                        OnNextLine ();
 
197
                                } catch {
 
198
                                        ForceStop ();
 
199
                                        throw;
 
200
                                }
 
201
                        }
 
202
                }
 
203
 
 
204
                public void StepLine ()
 
205
                {
 
206
                        lock (slock) {
 
207
                                OnRunning ();
 
208
                                try {
 
209
                                        OnStepLine ();
 
210
                                } catch {
 
211
                                        ForceStop ();
 
212
                                        throw;
 
213
                                }
 
214
                        }
 
215
                }
 
216
                
 
217
                public void NextInstruction ()
 
218
                {
 
219
                        lock (slock) {
 
220
                                OnRunning ();
 
221
                                try {
 
222
                                        OnNextInstruction ();
 
223
                                } catch {
 
224
                                        ForceStop ();
 
225
                                        throw;
 
226
                                }
 
227
                        }
 
228
                }
 
229
 
 
230
                public void StepInstruction ()
 
231
                {
 
232
                        lock (slock) {
 
233
                                OnRunning ();
 
234
                                try {
 
235
                                        OnStepInstruction ();
 
236
                                } catch {
 
237
                                        ForceStop ();
 
238
                                        throw;
 
239
                                }
 
240
                        }
 
241
                }
 
242
 
 
243
                public void Finish ()
 
244
                {
 
245
                        lock (slock) {
 
246
                                OnRunning ();
 
247
                                try {
 
248
                                        OnFinish ();
 
249
                                } catch {
 
250
                                        ForceStop ();
 
251
                                        throw;
 
252
                                }
 
253
                        }
 
254
                }
 
255
                
 
256
                public bool IsBreakEventValid (BreakEvent be)
 
257
                {
 
258
                        if (!started)
 
259
                                return true;
 
260
                        
 
261
                        object handle;
 
262
                        return (breakpoints.TryGetValue (be, out handle) && handle != null);
 
263
                }
 
264
 
 
265
                void AddBreakEvent (BreakEvent be)
 
266
                {
 
267
                        object handle = null;
 
268
                        
 
269
                        try {
 
270
                                handle = OnInsertBreakEvent (be, be.Enabled);
 
271
                        } catch (Exception ex) {
 
272
                                Breakpoint bp = be as Breakpoint;
 
273
                                if (bp != null)
 
274
                                        logWriter (false, "Could not set breakpoint at location '" + bp.FileName + ":" + bp.Line + "' (" + ex.Message + ")\n");
 
275
                                else
 
276
                                        logWriter (false, "Could not set catchpoint for exception '" + ((Catchpoint)be).ExceptionName + "' (" + ex.Message + ")\n");
 
277
                        }
 
278
                        
 
279
                        breakpoints.Add (be, handle);
 
280
                        Breakpoints.NotifyStatusChanged (be);
 
281
                }
 
282
 
 
283
                void RemoveBreakEvent (BreakEvent be)
 
284
                {
 
285
                        object handle;
 
286
                        if (GetBreakpointHandle (be, out handle)) {
 
287
                                breakpoints.Remove (be);
 
288
                                if (handle != null)
 
289
                                        OnRemoveBreakEvent (handle);
 
290
                        }
 
291
                }
 
292
                
 
293
                void UpdateBreakEventStatus (BreakEvent be)
 
294
                {
 
295
                        object handle;
 
296
                        if (GetBreakpointHandle (be, out handle) && handle != null)
 
297
                                OnEnableBreakEvent (handle, be.Enabled);
 
298
                }
 
299
                
 
300
                void UpdateBreakEvent (BreakEvent be)
 
301
                {
 
302
                        object handle;
 
303
                        if (GetBreakpointHandle (be, out handle)) {
 
304
                                if (handle != null) {
 
305
                                        object newHandle = OnUpdateBreakEvent (handle, be);
 
306
                                        if (newHandle != handle && (newHandle == null || !newHandle.Equals (handle))) {
 
307
                                                // Update the handle if it has changed, and notify the status change
 
308
                                                breakpoints [be] = newHandle;
 
309
                                        }
 
310
                                        Breakpoints.NotifyStatusChanged (be);
 
311
                                } else {
 
312
                                        // Try inserting the breakpoint again
 
313
                                        try {
 
314
                                                handle = OnInsertBreakEvent (be, be.Enabled);
 
315
                                                if (handle != null) {
 
316
                                                        // This time worked
 
317
                                                        breakpoints [be] = handle;
 
318
                                                        Breakpoints.NotifyStatusChanged (be);
 
319
                                                }
 
320
                                        } catch (Exception ex) {
 
321
                                                Breakpoint bp = be as Breakpoint;
 
322
                                                if (bp != null)
 
323
                                                        logWriter (false, "Could not set breakpoint at location '" + bp.FileName + ":" + bp.Line + " (" + ex.Message + ")\n");
 
324
                                                else
 
325
                                                        logWriter (false, "Could not set catchpoint for exception '" + ((Catchpoint)be).ExceptionName + "' (" + ex.Message + ")\n");
 
326
                                        }
 
327
                                }
 
328
                        }
 
329
                }
 
330
                
 
331
                void OnBreakpointAdded (object s, BreakEventArgs args)
 
332
                {
 
333
                        lock (slock) {
 
334
                                if (started)
 
335
                                        AddBreakEvent (args.BreakEvent);
 
336
                        }
 
337
                }
 
338
                
 
339
                void OnBreakpointRemoved (object s, BreakEventArgs args)
 
340
                {
 
341
                        lock (slock) {
 
342
                                if (started)
 
343
                                        RemoveBreakEvent (args.BreakEvent);
 
344
                        }
 
345
                }
 
346
                
 
347
                void OnBreakpointModified (object s, BreakEventArgs args)
 
348
                {
 
349
                        lock (slock) {
 
350
                                if (started)
 
351
                                        UpdateBreakEvent (args.BreakEvent);
 
352
                        }
 
353
                }
 
354
                
 
355
                void OnBreakpointStatusChanged (object s, BreakEventArgs args)
 
356
                {
 
357
                        lock (slock) {
 
358
                                if (started)
 
359
                                        UpdateBreakEventStatus (args.BreakEvent);
 
360
                        }
 
361
                }
 
362
                
 
363
                protected bool GetBreakpointHandle (BreakEvent be, out object handle)
 
364
                {
 
365
                        return breakpoints.TryGetValue (be, out handle);
 
366
                }
 
367
 
 
368
                public void Continue ()
 
369
                {
 
370
                        lock (slock) {
 
371
                                OnRunning ();
 
372
                                try {
 
373
                                        OnContinue ();
 
374
                                } catch {
 
375
                                        ForceStop ();
 
376
                                        throw;
 
377
                                }
 
378
                        }
 
379
                }
 
380
 
 
381
                public void Stop ()
 
382
                {
 
383
                        lock (slock) {
 
384
                                OnStop ();
 
385
                        }
 
386
                }
 
387
 
 
388
                public void Exit ()
 
389
                {
 
390
                        lock (slock) {
 
391
                                OnExit ();
 
392
                        }
 
393
                }
 
394
 
 
395
                public bool IsRunning {
 
396
                        get {
 
397
                                lock (slock) {
 
398
                                        return isRunning;
 
399
                                }
 
400
                        }
 
401
                }
 
402
                
 
403
                public ProcessInfo[] GetPocesses ()
 
404
                {
 
405
                        lock (slock) {
 
406
                                if (currentProcesses == null) {
 
407
                                        currentProcesses = OnGetPocesses ();
 
408
                                        foreach (ProcessInfo p in currentProcesses)
 
409
                                                p.Attach (this);
 
410
                                }
 
411
                                return currentProcesses;
 
412
                        }
 
413
                }
 
414
                
 
415
                public OutputWriterDelegate OutputWriter {
 
416
                        get { return outputWriter; }
 
417
                        set {
 
418
                                lock (olock) {
 
419
                                        outputWriter = value;
 
420
                                }
 
421
                        }
 
422
                }
 
423
                
 
424
                public OutputWriterDelegate LogWriter {
 
425
                        get { return logWriter; }
 
426
                        set {
 
427
                                lock (olock) {
 
428
                                        logWriter = value;
 
429
                                }
 
430
                        }
 
431
                }
 
432
 
 
433
                public AssemblyLine[] DisassembleFile (string file)
 
434
                {
 
435
                        lock (slock) {
 
436
                                return OnDisassembleFile (file);
 
437
                        }
 
438
                }
 
439
                
 
440
                internal ThreadInfo[] GetThreads (int processId)
 
441
                {
 
442
                        lock (slock) {
 
443
                                ThreadInfo[] threads = OnGetThreads (processId);
 
444
                                foreach (ThreadInfo t in threads)
 
445
                                        t.Attach (this);
 
446
                                return threads;
 
447
                        }
 
448
                }
 
449
                
 
450
                internal Backtrace GetBacktrace (int processId, int threadId)
 
451
                {
 
452
                        lock (slock) {
 
453
                                Backtrace bt = OnGetThreadBacktrace (processId, threadId);
 
454
                                if (bt != null)
 
455
                                        bt.Attach (this);
 
456
                                return bt;
 
457
                        }
 
458
                }
 
459
                
 
460
                void ForceStop ()
 
461
                {
 
462
                        TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetStopped);
 
463
                        OnTargetEvent (args);
 
464
                }
 
465
                
 
466
                internal protected void OnTargetEvent (TargetEventArgs args)
 
467
                {
 
468
                        currentProcesses = null;
 
469
                        
 
470
                        if (args.Process != null)
 
471
                                args.Process.Attach (this);
 
472
                        if (args.Thread != null) {
 
473
                                args.Thread.Attach (this);
 
474
                                activeThread = args.Thread;
 
475
                        }
 
476
                        
 
477
                        switch (args.Type) {
 
478
                                case TargetEventType.ExceptionThrown:
 
479
                                        lock (slock) {
 
480
                                                isRunning = false;
 
481
                                        }
 
482
                                        if (TargetExceptionThrown != null)
 
483
                                                TargetExceptionThrown (this, args);
 
484
                                        break;
 
485
                                case TargetEventType.TargetExited:
 
486
                                        lock (slock) {
 
487
                                                isRunning = false;
 
488
                                                started = false;
 
489
                                                foreach (BreakEvent bp in Breakpoints)
 
490
                                                        Breakpoints.NotifyStatusChanged (bp);
 
491
                                        }
 
492
                                        if (TargetExited != null)
 
493
                                                TargetExited (this, args);
 
494
                                        break;
 
495
                                case TargetEventType.TargetHitBreakpoint:
 
496
                                        lock (slock) {
 
497
                                                isRunning = false;
 
498
                                        }
 
499
                                        if (TargetHitBreakpoint != null)
 
500
                                                TargetHitBreakpoint (this, args);
 
501
                                        break;
 
502
                                case TargetEventType.TargetInterrupted:
 
503
                                        lock (slock) {
 
504
                                                isRunning = false;
 
505
                                        }
 
506
                                        if (TargetInterrupted != null)
 
507
                                                TargetInterrupted (this, args);
 
508
                                        break;
 
509
                                case TargetEventType.TargetSignaled:
 
510
                                        lock (slock) {
 
511
                                                isRunning = false;
 
512
                                        }
 
513
                                        if (TargetSignaled != null)
 
514
                                                TargetSignaled (this, args);
 
515
                                        break;
 
516
                                case TargetEventType.TargetStopped:
 
517
                                        lock (slock) {
 
518
                                                isRunning = false;
 
519
                                        }
 
520
                                        if (TargetStopped != null)
 
521
                                                TargetStopped (this, args);
 
522
                                        break;
 
523
                                case TargetEventType.UnhandledException:
 
524
                                        lock (slock) {
 
525
                                                isRunning = false;
 
526
                                        }
 
527
                                        if (TargetUnhandledException != null)
 
528
                                                TargetUnhandledException (this, args);
 
529
                                        break;
 
530
                        }
 
531
                        if (TargetEvent != null)
 
532
                                TargetEvent (this, args);
 
533
                }
 
534
                
 
535
                internal void OnRunning ()
 
536
                {
 
537
                        isRunning = true;
 
538
                        if (TargetStarted != null)
 
539
                                TargetStarted (this, EventArgs.Empty);
 
540
                }
 
541
                
 
542
                internal protected void OnStarted ()
 
543
                {
 
544
                        lock (slock) {
 
545
                                started = true;
 
546
                                foreach (BreakEvent bp in breakpointStore)
 
547
                                        AddBreakEvent (bp);
 
548
                        }
 
549
                }
 
550
                
 
551
                internal protected void OnTargetOutput (bool isStderr, string text)
 
552
                {
 
553
                        lock (olock) {
 
554
                                if (outputWriter != null)
 
555
                                        outputWriter (isStderr, text);
 
556
                        }
 
557
                }
 
558
                
 
559
                internal protected void OnDebuggerOutput (bool isStderr, string text)
 
560
                {
 
561
                        lock (olock) {
 
562
                                if (logWriter != null)
 
563
                                        logWriter (isStderr, text);
 
564
                        }
 
565
                }
 
566
                
 
567
                BreakEvent GetBreakEvent (object handle)
 
568
                {
 
569
                        foreach (KeyValuePair<BreakEvent,object> e in breakpoints) {
 
570
                                if (handle == e.Value || handle.Equals (e.Value))
 
571
                                        return e.Key;
 
572
                        }
 
573
                        return null;
 
574
                }
 
575
                
 
576
                internal protected bool OnCustomBreakpointAction (string actionId, object handle)
 
577
                {
 
578
                        BreakEvent ev = GetBreakEvent (handle);
 
579
                        return ev != null && customBreakpointHitHandler (actionId, ev);
 
580
                }
 
581
                
 
582
                protected void UpdateHitCount (object breakEventHandle, int count)
 
583
                {
 
584
                        BreakEvent ev = GetBreakEvent (breakEventHandle);
 
585
                        if (ev != null) {
 
586
                                ev.HitCount = count;
 
587
                                ev.NotifyUpdate ();
 
588
                        }
 
589
                }
 
590
                
 
591
                protected void UpdateLastTraceValue (object breakEventHandle, string value)
 
592
                {
 
593
                        BreakEvent ev = GetBreakEvent (breakEventHandle);
 
594
                        if (ev != null) {
 
595
                                ev.LastTraceValue = value;
 
596
                                ev.NotifyUpdate ();
 
597
                        }
 
598
                }
 
599
                
 
600
                protected abstract void OnRun (DebuggerStartInfo startInfo);
 
601
 
 
602
                protected abstract void OnAttachToProcess (int processId);
 
603
                
 
604
                protected abstract void OnDetach ();
 
605
                
 
606
                protected abstract void OnSetActiveThread (int processId, int threadId);
 
607
 
 
608
                protected abstract void OnStop ();
 
609
                
 
610
                protected abstract void OnExit ();
 
611
 
 
612
                // Step one source line
 
613
                protected abstract void OnStepLine ();
 
614
 
 
615
                // Step one source line, but step over method calls
 
616
                protected abstract void OnNextLine ();
 
617
 
 
618
                // Step one instruction
 
619
                protected abstract void OnStepInstruction ();
 
620
 
 
621
                // Step one instruction, but step over method calls
 
622
                protected abstract void OnNextInstruction ();
 
623
 
 
624
                // Continue until leaving the current method
 
625
                protected abstract void OnFinish ();
 
626
 
 
627
                //breakpoints etc
 
628
 
 
629
                // returns a handle
 
630
                protected abstract object OnInsertBreakEvent (BreakEvent be, bool activate);
 
631
 
 
632
                protected abstract void OnRemoveBreakEvent (object handle);
 
633
                
 
634
                protected abstract object OnUpdateBreakEvent (object handle, BreakEvent be);
 
635
                
 
636
                protected abstract void OnEnableBreakEvent (object handle, bool enable);
 
637
 
 
638
                protected abstract void OnContinue ();
 
639
                
 
640
                protected abstract ThreadInfo[] OnGetThreads (int processId);
 
641
                
 
642
                protected abstract ProcessInfo[] OnGetPocesses ();
 
643
                
 
644
                protected abstract Backtrace OnGetThreadBacktrace (int processId, int threadId);
 
645
 
 
646
                protected virtual AssemblyLine[] OnDisassembleFile (string file)
 
647
                {
 
648
                        return null;
 
649
                }
 
650
                
 
651
                protected IDebuggerSessionFrontend Frontend {
 
652
                        get {
 
653
                                return frontend;
 
654
                        }
 
655
                }
 
656
        }
 
657
        
 
658
        class InternalDebuggerSession: IDebuggerSessionFrontend
 
659
        {
 
660
                DebuggerSession session;
 
661
                
 
662
                public InternalDebuggerSession (DebuggerSession session)
 
663
                {
 
664
                        this.session = session;
 
665
                }
 
666
                
 
667
                public void NotifyTargetEvent (TargetEventArgs args)
 
668
                {
 
669
                        session.OnTargetEvent (args);
 
670
                }
 
671
 
 
672
                public void NotifyTargetOutput (bool isStderr, string text)
 
673
                {
 
674
                        session.OnTargetOutput (isStderr, text);
 
675
                }
 
676
                
 
677
                public void NotifyDebuggerOutput (bool isStderr, string text)
 
678
                {
 
679
                        session.OnDebuggerOutput (isStderr, text);
 
680
                }
 
681
                
 
682
                public void NotifyStarted ()
 
683
                {
 
684
                        session.OnStarted ();
 
685
                }
 
686
                
 
687
                public bool NotifyCustomBreakpointAction (string actionId, object handle)
 
688
                {
 
689
                        return session.OnCustomBreakpointAction (actionId, handle);
 
690
                }
 
691
        }
 
692
 
 
693
        public delegate void OutputWriterDelegate (bool isStderr, string text);
 
694
        
 
695
}