Oolite 1.91.0.7604-240417-a536cbe
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
OODebugSupport.m File Reference
import "OODebugSupport.h"
import "ResourceManager.h"
import "OOCollectionExtractors.h"
import "OODebugMonitor.h"
import "OODebugTCPConsoleClient.h"
import "GameController.h"
import "OOJavaScriptEngine.h"
+ Include dependency graph for OODebugSupport.m:

Go to the source code of this file.

Classes

category  NSObject(OODebugPlugInController)
 

Macros

#define LoadDebugPlugIn()   nil
 

Functions

void OOInitDebugSupport (void)
 

Variables

static id sDebugPlugInController
 

Macro Definition Documentation

◆ LoadDebugPlugIn

#define LoadDebugPlugIn ( )    nil

Definition at line 43 of file OODebugSupport.m.

Function Documentation

◆ OOInitDebugSupport()

void OOInitDebugSupport ( void )

Definition at line 57 of file OODebugSupport.m.

58{
59 NSString *debugOXPPath = nil;
60 NSDictionary *debugSettings = nil;
61 NSString *consoleHost = nil;
62 unsigned short consolePort = 0;
63 id<OODebuggerInterface> debugger = nil;
64 BOOL activateDebugConsole = NO;
65
66 // Load debug settings.
67 debugSettings = [ResourceManager dictionaryFromFilesNamed:@"debugConfig.plist"
68 inFolder:@"Config"
69 mergeMode:MERGE_BASIC
70 cache:NO];
71
72 // Check that the debug OXP is installed. If not, we don't enable debug support.
73 debugOXPPath = [ResourceManager pathForFileNamed:@"DebugOXPLocatorBeacon.magic" inFolder:@"nil"];
74 if (debugOXPPath != nil)
75 {
76 // Load plug-in debugging code on platforms where this is supported.
78
79 consoleHost = [debugSettings oo_stringForKey:@"console-host"];
80 consolePort = [debugSettings oo_unsignedShortForKey:@"console-port"];
81
82 // If consoleHost is nil, and the debug plug-in can set up a debugger, use that.
83 if (consoleHost == nil && [sDebugPlugInController respondsToSelector:@selector(setUpDebugger)])
84 {
85 debugger = [sDebugPlugInController setUpDebugger];
86 [[OODebugMonitor sharedDebugMonitor] setUsingPlugInController:YES];
87 }
88
89 // Otherwise, use TCP debugger connection.
90 if (debugger == nil)
91 {
92 debugger = [[OODebugTCPConsoleClient alloc] initWithAddress:consoleHost
93 port:consolePort];
94 [debugger autorelease];
95 [[OODebugMonitor sharedDebugMonitor] setUsingPlugInController:NO];
96 }
97
98 activateDebugConsole = (debugger != nil);
99 }
100
101 if (!activateDebugConsole)
102 {
103 activateDebugConsole = [debugSettings oo_boolForKey:@"always-load-debug-console"];
104 }
105
106
107 if (activateDebugConsole)
108 {
109 // Set up monitor and register debugger, if any.
110 [[OODebugMonitor sharedDebugMonitor] setDebugger:debugger];
111 [[OOJavaScriptEngine sharedEngine] enableDebuggerStatement];
112 }
113}
static id sDebugPlugInController
#define LoadDebugPlugIn()
return nil
@ MERGE_BASIC

Variable Documentation

◆ sDebugPlugInController

id sDebugPlugInController
static

Definition at line 47 of file OODebugSupport.m.

Referenced by NSObject(OODebugPlugInController)::setUpDebugger.