Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
152aaf8
Suggested changes.
johnno1962 Apr 21, 2026
8ae418d
Debug only.
johnno1962 Apr 21, 2026
f31c17d
To discuss.
johnno1962 Apr 21, 2026
ec3d144
Compatibility.
johnno1962 Apr 21, 2026
d42ac3d
Tweak titles.
johnno1962 Apr 21, 2026
6156955
Tooltips, more environment vars.
johnno1962 Apr 21, 2026
8b72919
More Tooltips.
johnno1962 Apr 21, 2026
f4eec93
Overdue for reuse.
johnno1962 Apr 21, 2026
d64e83b
Missed the boat reconstructing PR.
johnno1962 Apr 21, 2026
6e980c9
Is client Connected?
johnno1962 Apr 21, 2026
068bbfc
Disarm bear trap, FrontendServer needs to start first.
johnno1962 Apr 21, 2026
735801f
Capturing logs was inhibiting my debug prints.
johnno1962 Apr 21, 2026
c88f585
Update App/InjectionNext/Views/FileWatcherSettingsView.swift
johnno1962 Apr 21, 2026
130f273
Update App/InjectionNext/Views/BuildSystemSettingsView.swift
johnno1962 Apr 21, 2026
a7c60c2
Update App/InjectionNext/ConfigStore.swift
johnno1962 Apr 21, 2026
ff21627
D'oh
johnno1962 Apr 21, 2026
8e92360
Update App/InjectionNext/Views/XcodeSettingsView.swift
johnno1962 Apr 21, 2026
d7282fa
Change default arguments text.
johnno1962 Apr 21, 2026
46641f0
Update App/InjectionNext/Views/StatusMenuView.swift
johnno1962 Apr 21, 2026
5bb066f
Update App/InjectionNext/Views/XcodeSettingsView.swift
johnno1962 Apr 21, 2026
fd973bd
Update App/InjectionNext/AppDelegate.swift
johnno1962 Apr 21, 2026
ec1be47
Move away from print for debugs.
johnno1962 Apr 21, 2026
04c7495
Recover Defaults.swift fro InjectionIII.
johnno1962 Apr 21, 2026
0084513
Debug prints on #DEBUG or INJECTION_DEBUG anv var.
johnno1962 Apr 21, 2026
5714dbf
More env vars, connected status.
johnno1962 Apr 21, 2026
9295705
Tracing preferences.
johnno1962 Apr 21, 2026
13f1a68
docs(todo): flesh out 2.0 Next section with fork-discovered items (#142)
maatheusgois-dd Apr 22, 2026
985e359
Update App/InjectionNext/Defaults.swift
johnno1962 Apr 22, 2026
ac7559a
Update App/InjectionNext/Views/XcodeSettingsView.swift
johnno1962 Apr 22, 2026
982d7f6
Update App/InjectionNext/Views/XcodeSettingsView.swift
johnno1962 Apr 22, 2026
821d6d4
Update App/InjectionNext/ConfigStore.swift
johnno1962 Apr 22, 2026
765220e
For rellease
johnno1962 Apr 22, 2026
8af79c5
Reinstate project path further down pane.
johnno1962 Apr 22, 2026
f74a900
UNSETENV_VALUE
johnno1962 Apr 22, 2026
1028341
Consolidate.
johnno1962 Apr 22, 2026
e4e358b
Update App/InjectionNext/InjectionHybrid.swift
johnno1962 Apr 22, 2026
941e3ea
Enough already.
johnno1962 Apr 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tracing preferences.
  • Loading branch information
johnno1962 committed Apr 21, 2026
commit 929570571de1972f8225df69b682588ebcdab86f
42 changes: 36 additions & 6 deletions App/InjectionNext/ConfigStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,36 @@ final class ConfigStore: ObservableObject {
client.writeCommand(InjectionCommand.setenv.rawValue,
with: INJECTION_BENCH)
client.write(benchmarking ? "1" : unsetVar)
client.writeCommand(InjectionCommand.setenv.rawValue,
with: INJECTION_TRACE_FILTER)
client.write(traceFilter != "" ? traceFilter : ".")
switch traceMode {
case .injected:
client.writeCommand(InjectionCommand.setenv.rawValue,
with: INJECTION_TRACE)
client.write("1")
case .all:
client.writeCommand(InjectionCommand.setenv.rawValue,
with: INJECTION_TRACE_ALL)
client.write("1")
case .off:
break
}
if traceFrameworks != "" {
client.writeCommand(InjectionCommand.setenv.rawValue,
with: INJECTION_TRACE_FRAMEWORKS)
client.write(traceFrameworks)
}
if traceUIKit != "" {
client.writeCommand(InjectionCommand.setenv.rawValue,
with: INJECTION_TRACE_UIKIT)
client.write(traceUIKit)
}
if traceLookup {
client.writeCommand(InjectionCommand.setenv.rawValue,
with: INJECTION_TRACE_LOOKUP)
client.write(traceUIKit)
Comment thread
johnno1962 marked this conversation as resolved.
Outdated
}
Comment thread
johnno1962 marked this conversation as resolved.
}

// MARK: - Devices
Expand All @@ -342,22 +372,22 @@ final class ConfigStore: ObservableObject {
}
@Published var availableIdentities: [String] = []

// MARK: - Tracing // difficult to implement as tracing happens early.
// MARK: - Tracing

@Published var traceMode: TraceMode {
didSet { ud.set(traceMode.rawValue, forKey: "traceMode") }
didSet { ud.set(traceMode.rawValue, forKey: "traceMode"); updateEnvVars() }
}
@Published var traceFilter: String {
didSet { ud.set(traceFilter, forKey: "traceFilter") }
didSet { ud.set(traceFilter, forKey: "traceFilter"); updateEnvVars() }
}
@Published var traceFrameworks: String {
didSet { ud.set(traceFrameworks, forKey: "traceFrameworks") }
didSet { ud.set(traceFrameworks, forKey: "traceFrameworks"); updateEnvVars() }
}
@Published var traceLookup: Bool {
didSet { ud.set(traceLookup, forKey: "traceLookup") }
didSet { ud.set(traceLookup, forKey: "traceLookup"); updateEnvVars() }
}
@Published var traceUIKit: String {
didSet { ud.set(traceUIKit, forKey: "traceUIKit") }
didSet { ud.set(traceUIKit, forKey: "traceUIKit"); updateEnvVars() }
}

// MARK: - File Watcher
Expand Down
2 changes: 1 addition & 1 deletion App/InjectionNext/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>14172</string>
<string>14181</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
72 changes: 66 additions & 6 deletions Sources/InjectionNext/InjectionNext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ open class InjectionNext: SimpleSocket {
log("Connection lost, disconnecting.")
}

func tracingOptions() {
lazy var setupTraceAdjustments: Void = {
SwiftTrace.injectableSymbol = Reloader.injectableSymbol
SwiftTrace.defaultMethodExclusions += // CoreFoundation
#"|\[NS(Method|Tagged|Array|\w*Dict|Date|Data|Timer)|allocWithZone:|__unurl|_trueSelf"#
+ #"|InjectionBundle.|fast_dl"#
}()

func tracingOptions() {
_ = setupTraceAdjustments
/// Custom type lookup on tracing.
if let exclude = getenv(INJECTION_TRACE_LOOKUP) {
if exclude[0] == UInt8(ascii: "|") {
Expand All @@ -126,8 +131,7 @@ open class InjectionNext: SimpleSocket {
SwiftTrace.typeLookup = true
}
if let filter = getenv(INJECTION_TRACE_FILTER) {
SwiftTrace.inclusionRegexp =
NSRegularExpression(regexp: String(cString: filter))
SwiftTrace.traceFilterInclude = String(cString: filter)
}
/// Entire App bundle tracing.
if let exclude = getenv(INJECTION_TRACE_ALL) {
Expand Down Expand Up @@ -281,10 +285,66 @@ open class InjectionNext: SimpleSocket {
}
case .setenv:
if let name = readString(), let value = readString() {
if value != "0" {
setenv(name, value, 1)
} else {
if value == "0" {
unsetenv(name)
} else {
_ = setupTraceAdjustments
if name == INJECTION_TRACE_FILTER {
SwiftTrace.traceFilterInclude = value
} else if getenv(name) == nil {
switch name {
case INJECTION_TRACE_LOOKUP:
if value.hasPrefix("|") {
SwiftTrace.defaultLookupExclusions += value
}
SwiftTrace.typeLookup = true
case INJECTION_TRACE_ALL:
SwiftTrace.interposeEclusions = SwiftTrace.exclusionRegexp
appBundleImages { imageName, _, _ in
if SwiftTrace.interposeMethods(inBundlePath: imageName) == 0,
strstr(imageName, "XCT") == nil {
self.error("""
Unable to interpose to trace image \
\(String(cString: imageName)), have you added \
"Other Linker Flags" -Xlinker -interposable
""")
}
SwiftTrace.trace(bundlePath: imageName)
}
case INJECTION_TRACE_FRAMEWORKS:
var frmwks = value
if frmwks == "" || frmwks == "1" { frmwks = "SwiftUI,SwiftUICore" }
for frmwk in frmwks.components(separatedBy: ",") {
if let dylib = DLKit.imageMap[frmwk] {
Self.target = dylib
appBundleImages { path, header, slide in
rebind_symbols_trace(autoBitCast(header), slide, Self.tracer)
}
} else {
error("Invalid trace framework \(frmwk)")
}
}
case INJECTION_TRACE_UIKIT:
var frmwks = value
if frmwks == "" || frmwks == "1" { frmwks = "UIKitCore" }
for frmwk in frmwks.components(separatedBy: ",") {
if let bundle = DLKit.imageMap[frmwk]?.imageName {
SwiftTrace.trace(bundlePath: bundle)
} else {
error("Invalid swizzle framework \(frmwk)")
}
}
case INJECTION_TRACE:
Reloader.traceHook = { (injected, name) in
let name = SwiftMeta.demangle(symbol: name) ?? String(cString: name)
detail("SwiftTracing \(name)")
return autoBitCast(SwiftTrace.trace(name: name, original: injected)) ?? injected
}
default:
break
}
}
setenv(name, value, 1)
}
}
case .EOF:
Expand Down