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