3 * Copyright (c) 2007 - 2010, Blue Static <http://www.bluestatic.org>
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 #import <Cocoa/Cocoa.h>
19 #import "Breakpoint.h"
20 #import "StackFrame.h"
22 @protocol DebuggerProcessorDelegate
;
24 // The DebuggerConnection is the communication layer between the application
25 // and the Xdebug engine. Clients can issue debugger commands using this class,
26 // which are sent in an asynchronous manner. Reads are also asynchronous and
27 // the primary client of this class should set itself as the delegate. The
28 // primary unit that this class deals with is the StackFrame; clients should
29 // maintain a stack structure and the Connection will inform the delegate when
30 // a new frame is created or the stack should be destroyed.
31 @interface DebuggerProcessor
: NSObject
33 // The port to connect on.
36 // If the connection to the debugger engine is currently active.
39 // Human-readable status of the connection.
42 // The connection's delegate.
43 id
<DebuggerProcessorDelegate
> delegate
;
45 // A dictionary that maps routingIDs to StackFrame objects.
46 NSMutableDictionary
* stackFrames_
;
47 // The stack depth for the current build of |stackFrames_|.
48 NSInteger stackDepth_
;
49 // The earliest transaction ID for the current build of |stackFrames_|.
50 NSInteger stackFirstTransactionID_
;
52 // This stores additional context information for the callback selector.
53 // This dictionary is keyed by the same transaction IDs in |callTable_|, but
54 // also stores some other object that can be accessed in the callback.
55 NSMutableDictionary
* callbackContext_
;
58 @
property (readonly
, copy
) NSString
* status
;
59 @
property (assign
) id
<DebuggerProcessorDelegate
> delegate
;
62 - (id
)initWithPort
:(NSUInteger
)aPort
;
66 - (NSString
*)remoteHost
;
75 - (void)addBreakpoint
:(Breakpoint
*)bp
;
76 - (void)removeBreakpoint
:(Breakpoint
*)bp
;
78 // Gets a property by name from the debugger engine. Returns a transaction ID
79 // which used in the delegate callback.
80 - (NSInteger
)getProperty
:(NSString
*)property
;
84 // Delegate ////////////////////////////////////////////////////////////////////
86 @protocol DebuggerProcessorDelegate
<NSObject
>
88 // Passes up errors from SocketWrapper and any other errors generated by the
90 - (void)errorEncountered
:(NSString
*)error
;
92 // Called when the socket connects. Passed up from SocketWrapper.
93 - (void)debuggerConnected
;
95 // Called when we disconnect.
96 - (void)debuggerDisconnected
;
98 // Tells the debugger to destroy the current stack display.
101 // Tells the debugger that a new stack frame is avaliable.
102 - (void)newStackFrame
:(StackFrame
*)frame
;
104 // Tells the debugger that new source is available for the given frame.
105 - (void)sourceUpdated
:(StackFrame
*)frame
;
107 // Callback from |-getProperty:|.
108 - (void)receivedProperties
:(NSArray
*)properties forTransaction
:(NSInteger
)transaction
;