Menu

[r129]: / APIInterface / DBXcode3Profile.m  Maximize  Restore  History

Download this file

51 lines (37 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#import "XCPBuildSystem.h"
#import "XCPDependencyGraph.h"
#import <objc/runtime.h>
#import <sys/sysctl.h>
#define HOOK_CALL_ORIG_NA(hook_name) __hookorig_##hook_name(self, _sel);
#define HOOK_CALL_ORIG(hook_name,...) __hookorig_##hook_name(self, _sel, __VA_ARGS__);
#define DECLARE_AND_DEFINE_HOOK_NA(hook_name, return_type) \
typedef return_type (*__hooktype_##hook_name)(id self, SEL _sel); \
__hooktype_##hook_name __hookorig_##hook_name = nil; \
return_type __hooknew_##hook_name(id self, SEL _sel)
#define DECLARE_AND_DEFINE_HOOK(hook_name, return_type, ...) \
typedef return_type (*__hooktype_##hook_name)(id self, SEL _sel, __VA_ARGS__); \
__hooktype_##hook_name __hookorig_##hook_name = nil; \
return_type __hooknew_##hook_name(id self, SEL _sel, __VA_ARGS__)
#define HOOK_SETUP(hook_name, class_name, selector_name) { \
Method __hooked_method = class_getInstanceMethod([class_name class], @selector(selector_name)); \
(void*)__hookorig_##hook_name = (void*) method_setImplementation(__hooked_method, (IMP)__hooknew_##hook_name); \
}
DECLARE_AND_DEFINE_HOOK_NA(processDependencyGraphEvents, void) {
HOOK_CALL_ORIG_NA(processDependencyGraphEvents);
[self writeToGraphVizFileAtPath:[self expandedValueForString:@"$(TEMP_DIR)/depend.dot"]];
}
DECLARE_AND_DEFINE_HOOK(createDependencyGraphWithTargetDGSnapshot_, void, id dgs) {
HOOK_CALL_ORIG(createDependencyGraphWithTargetDGSnapshot_, dgs);
[self writeToGraphVizFileAtPath:[self expandedValueForString:@"$(TEMP_DIR)/depend-bis.dot"]];
}
void xcodeprofile_init() {
NSAutoreleasePool* pool = [NSAutoreleasePool new];
// Only express us inside the Xcode application
if(![[[NSProcessInfo processInfo] processName] isEqualToString:@"Xcode"]) goto exit;
// Setup
HOOK_SETUP(processDependencyGraphEvents, PBXTargetBuildContext, processDependencyGraphEvents);
HOOK_SETUP(createDependencyGraphWithTargetDGSnapshot_, PBXTargetBuildContext, createDependencyGraphWithTargetDGSnapshot:);
NSLog(@"Xcode Debugging Tools loaded");
exit:
[pool release];
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.