Line data Source code
1 0 : /* 2 : 3 : OODebugMonitor.h 4 : 5 : Debugging services object for Oolite. 6 : 7 : The debug controller implements Oolite's part of debugging support. It can 8 : connect to one debugger object, which conforms to the OODebuggerInterface 9 : formal protocol. This can either be (part of) a debugger loaded into Oolite 10 : itself (as in the Mac Debug OXP), or provide communications with an external 11 : debugger (for instance, over Distributed Objects or TCP/IP). 12 : 13 : 14 : Oolite debug support 15 : 16 : Copyright (C) 2007-2013 Jens Ayton 17 : 18 : Permission is hereby granted, free of charge, to any person obtaining a copy 19 : of this software and associated documentation files (the "Software"), to deal 20 : in the Software without restriction, including without limitation the rights 21 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 : copies of the Software, and to permit persons to whom the Software is 23 : furnished to do so, subject to the following conditions: 24 : 25 : The above copyright notice and this permission notice shall be included in all 26 : copies or substantial portions of the Software. 27 : 28 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 : SOFTWARE. 35 : 36 : */ 37 : 38 : #import "OOCocoa.h" 39 : #import "OOWeakReference.h" 40 : #import "OODebuggerInterface.h" 41 : 42 : @class OOJSScript; 43 : 44 : 45 : @protocol OODebugMonitorInterface 46 : 47 : // Note: disconnectDebugger:message: will cause a disconnectDebugMonitor:message: message to be sent to the debugger. The debugger should not send disconnectDebugger:message: in response to disconnectDebugMonitor:message:. 48 0 : - (void)disconnectDebugger:(in id<OODebuggerInterface>)debugger 49 : message:(in NSString *)message; 50 : 51 : 52 : // *** JavaScript console support. 53 : 54 : // Perform a JS command as though entered at the console, including echoing. 55 0 : - (oneway void)performJSConsoleCommand:(in NSString *)command; 56 : 57 0 : - (id)configurationValueForKey:(in NSString *)key; 58 0 : - (void)setConfigurationValue:(in id)value forKey:(in NSString *)key; 59 : 60 0 : - (NSString *)sourceCodeForFile:(in NSString *)filePath line:(in unsigned)line; 61 : 62 : @end 63 : 64 : 65 0 : @interface OODebugMonitor: OOWeakRefObject <OODebugMonitorInterface> 66 : { 67 : @private 68 : id<OODebuggerInterface> _debugger; 69 0 : 70 : // JavaScript console support. 71 : OOJSScript *_script; 72 0 : struct JSObject *_jsSelf; 73 0 : 74 : NSDictionary *_configFromOXPs; // Settings from debugConfig.plist 75 0 : NSMutableDictionary *_configOverrides; // Settings from preferences, modifiable through JS. 76 0 : 77 : // Caches 78 : NSMutableDictionary *_fgColors, 79 0 : *_bgColors, 80 0 : *_sourceFiles; 81 0 : // TCP options 82 : BOOL _TCPIgnoresDroppedPackets; 83 0 : BOOL _usingPlugInController; 84 0 : } 85 : 86 : + (OODebugMonitor *) sharedDebugMonitor; 87 0 : - (BOOL)setDebugger:(id<OODebuggerInterface>)debugger; 88 0 : 89 : // *** JavaScript console support. 90 : - (void)appendJSConsoleLine:(id)string 91 0 : colorKey:(NSString *)colorKey 92 : emphasisRange:(NSRange)emphasisRange; 93 : 94 : - (void)appendJSConsoleLine:(id)string 95 0 : colorKey:(NSString *)colorKey; 96 : 97 : - (void)clearJSConsole; 98 0 : - (void)showJSConsole; 99 0 : 100 : - (id)configurationValueForKey:(NSString *)key class:(Class)class defaultValue:(id)value; 101 0 : - (long long)configurationIntValueForKey:(NSString *)key defaultValue:(long long)value; 102 0 : 103 : - (NSArray *)configurationKeys; 104 0 : 105 : - (BOOL) debuggerConnected; 106 0 : 107 : - (void) dumpMemoryStatistics; 108 0 : - (size_t) dumpJSMemoryStatistics; 109 0 : 110 : - (void) setTCPIgnoresDroppedPackets:(BOOL)flag; 111 0 : - (BOOL) TCPIgnoresDroppedPackets; 112 0 : 113 : - (void) setUsingPlugInController:(BOOL)flag; 114 0 : - (BOOL) usingPlugInController; 115 0 : 116 : #if OOLITE_GNUSTEP 117 : - (void) applicationWillTerminate; 118 : #endif 119 : 120 : @end 121 :