Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.

Commit 0ea1734

Browse files
johnno1962yeswolf
andauthored
Xcode 12 gm (johnno1962#265)
* Changes relative to master to build for Big Sur and Apple Silicon * Update checking off GitHub * A pinch of salt * Use tagName comparison against version. * Apple Silicon fix * Re-sync perforce. * Move compilation back into App where it belongs. * Last minute project changes * Get storyboard injection working again * New form of tracing for SwiftUI * Unending tweaks to SwiftTrace after introducing interposing * SwiftUI type handlers + Trace output filtering * Fix AppCode compatibility (johnno1962#267) Cheers! * Safer version of legacy injection (which we don't use anymore anyway) * Build bundles in Release mode at last + Dark mode * Separate out SwiftTrace into framework * tvOS deployment target to avoid "small" Objective-C meta data * Extra hints and clean up of bundle build script. * Custom type handlers for tracing & removing a few warnings. * Build time RPATH check & Reinstate EvalApp eexample * Full circle. * macOS .swiftinterface files * Injection Goto service. * Update to use swift_getTypeName for fully qualified type name * Service Meta-data error * Late binding XCTest framework * Many more tracing options. * Per-framework tracing * Dumping of invocation stats. * Objc injection goto. * Trace system frameworks * Break out some code. * Support for method call order profiling * Source file re-ordering after trace for paging performance * Afterthoughts. * Sync https://github.com/johnno1962/StringIndex, rename Objc header * Sync StringIndex, SwiftTrace including "EasyPointer" * Support un-tracing (revert interposes) * 2.4.1 Release for Big Sur * -fprofile-instr-generate on dylib * Pre-merge to master Co-authored-by: yeswolf <[email protected]>
1 parent fe3509b commit 0ea1734

35 files changed

+2241
-659
lines changed

AppCodePlugin/Injection.jar

223 Bytes
Binary file not shown.

AppCodePlugin/META-INF/plugin.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin version="2">
22
<id>com.injectionforxcode.injection.plugin.id</id>
33
<name>InjectionIII for AppCode</name>
4-
<version>4.0</version>
4+
<version>4.1</version>
55
<vendor email="[email protected]" url="https://github.com/johnno1962/InjectionIII">Injection for Xcode</vendor>
66

77
<description><![CDATA[

AppCodePlugin/src/com/injectionforxcode/InjectionAction.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* Copyright (c) 2013 John Holdsworth. All rights reserved.
1717
*
18-
* $Id: //depot/ResidentEval/InjectionPluginAppCode/src/com/injectionforxcode/InjectionAction.java#1 $
18+
* $Id: //depot/ResidentEval/AppCodePlugin/src/com/injectionforxcode/InjectionAction.java#3 $
1919
*
2020
* Created with IntelliJ IDEA.
2121
* Date: 24/02/2013
@@ -110,7 +110,8 @@ void serviceClientApp(final Socket socket) throws Throwable {
110110
sentProjectPath = false;
111111

112112
// Temporary dorectory to use
113-
writeString(clientOutput, "/tmp");
113+
final String tmpDir = "/tmp", prefix = tmpDir+"/eval";
114+
writeString(clientOutput, tmpDir);
114115

115116
// Sanity check
116117
if (!"bvijkijyhbtrbrebzjbbzcfbbvvq".equals(readString(clientInput)))
@@ -131,6 +132,10 @@ public void run() {
131132
switch (InjectionResponse.values()[resp]) {
132133
case Sign:
133134
String dylib = readString(clientInput);
135+
if (!new File(dylib).exists())
136+
dylib = prefix+dylib;
137+
else if (!dylib.startsWith(prefix))
138+
error("Signing exception", new IOException("Invalid path"));
134139
try {
135140
Process process = Runtime.getRuntime().exec(new String[] {"/bin/bash", "-c",
136141
"(export CODESIGN_ALLOCATE=/Applications/Xcode.app" +
@@ -213,6 +218,8 @@ static int readInt(InputStream s) throws IOException {
213218

214219
static String readString(InputStream s) throws IOException {
215220
int pathLength = readInt(s);
221+
if (pathLength > 1000000)
222+
pathLength = readInt(s);
216223
byte buffer[] = new byte[pathLength];
217224
if (s.read(buffer) != pathLength)
218225
alert("Bad path read, pathLength :"+pathLength);

EvalApp/AppDelegate.swift

+3-5
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1717
@IBOutlet weak var closureText: NSTextField!
1818

1919
@IBAction func performEval(_: Any) {
20-
textView.string = eval(textField.stringValue)
20+
textView.string = swiftEvalString(contents: textField.stringValue)
2121
}
2222

2323
@IBAction func closureEval(_: Any) {
24-
if let block = eval(closureText.stringValue, (() -> ())?.self) {
25-
block()
26-
}
24+
_ = swiftEval(code: closureText.stringValue+"()")
2725
}
2826

2927
@objc func injected() {
@@ -34,7 +32,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3432
// Insert code here to initialize your application
3533
SwiftEval.instance.evalError = {
3634
let err = $0
37-
if !err.hasPrefix("Compiling ") {
35+
if !err.hasPrefix("💉 Compiling ") {
3836
DispatchQueue.main.async {
3937
self.textView.string = err
4038
}

EvalApp/Assets.xcassets/Contents.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

EvalApp/EvalApp.entitlements

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict/>
4+
<dict>
5+
<key>com.apple.security.cs.disable-library-validation</key>
6+
<true/>
7+
</dict>
58
</plist>

EvalApp/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>$(EXECUTABLE_NAME)</string>
99
<key>CFBundleIconFile</key>
10-
<string></string>
10+
<string>App.icns</string>
1111
<key>CFBundleIdentifier</key>
1212
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1313
<key>CFBundleInfoDictionaryVersion</key>

InjectionBundle/InjectionClient.h

+19
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
//
88

99
#import "SimpleSocket.h"
10+
#import "/tmp/InjectionSalt.h"
1011

1112
#define INJECTION_ADDRESS @":8898"
1213
#define INJECTION_KEY @"bvijkijyhbtrbrebzjbbzcfbbvvq"
14+
#define FRAMEWORK_DELIMITER @","
15+
#define CALLORDER_DELIMITER @"---"
1316

1417
@interface InjectionClient : SimpleSocket
1518

@@ -30,6 +33,20 @@ typedef NS_ENUM(int, InjectionCommand) {
3033

3134
InjectionTrace,
3235
InjectionUntrace,
36+
InjectionTraceUI,
37+
InjectionTraceUIKit,
38+
InjectionTraceSwiftUI,
39+
InjectionTraceFramework,
40+
InjectionQuietInclude,
41+
InjectionInclude,
42+
InjectionExclude,
43+
InjectionStats,
44+
InjectionCallOrder,
45+
InjectionFileOrder,
46+
InjectionFileReorder,
47+
InjectionUninterpose,
48+
49+
InjectionInvalid = 1000,
3350

3451
InjectionEOF = ~0
3552
};
@@ -40,6 +57,8 @@ typedef NS_ENUM(int, InjectionResponse) {
4057
InjectionPause,
4158
InjectionSign,
4259
InjectionError,
60+
InjectionFrameworkList,
61+
InjectionCallOrderList,
4362

4463
InjectionExit = ~0
4564
};

0 commit comments

Comments
 (0)