Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.DS_Store
/.vscode/
/.swiftpm/
/.swiftpm/*
!/.swiftpm/configuration/
!/.swiftpm/configuration/mirrors.json
/.swiftpm/xcode/xcuserdata/
/.swiftpm/xcode/package.xcworkspace/xcuserdata/
/.build
Expand Down
13 changes: 13 additions & 0 deletions .swiftpm/configuration/mirrors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"object" : [
{
"mirror" : "https://github.com/lynnswap/MachOKit.git",
"original" : "https://github.com/MxIris-Reverse-Engineering/MachOKit"
},
{
"mirror" : "https://github.com/lynnswap/MachOKit.git",
"original" : "https://github.com/MxIris-Reverse-Engineering/MachOKit.git"
}
],
"version" : 1
}
5 changes: 2 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let package = Package(
),
.package(
url: "https://github.com/MxIris-Reverse-Engineering/MachOKit.git",
from: "0.51.101"
revision: "e0e0b30187ae74f2088d932845c8ddac2c79f36c"
),
.package(
url: "https://github.com/lynnswap/MachOObjCSection.git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import Dispatch
import MachOKit
@_spi(Support) import MachOKit
@_spi(Diagnostics) import MachOObjCSection
import MachOSwiftSection
import ObjCDump
Expand Down Expand Up @@ -442,6 +442,7 @@ private func dumpImage(
return
}
profileLogDuration(enabled: options.profile, imagePath: imagePath, name: "loadMachO", since: loadStart)
try machO.validateFileBackedChainedFixups()

if options.verbose {
print("Dumping: \(placement.identity.url.path)")
Expand Down Expand Up @@ -486,6 +487,11 @@ private func defaultSwiftInterfaceBuilderFactory(
enum RawMachO {
case file(MachOFile)
case loaded(MachOImage)

func validateFileBackedChainedFixups() throws {
guard case .file(let file) = self else { return }
try file.validateChainedFixups()
}
}

enum RawMachOLoadError: Error, Equatable, CustomStringConvertible, Sendable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct PrivateHeaderKitHelperProtocolTests {
#expect(report.omittedDiagnosticCount == UInt.max)
}

@Test func resolvedGraphPinsObjectiveCReaderForkExactly() throws {
@Test func resolvedGraphPinsReaderForksExactly() throws {
let packageRoot = URL(fileURLWithPath: #filePath)
.deletingLastPathComponent()
.deletingLastPathComponent()
Expand Down Expand Up @@ -176,6 +176,41 @@ struct PrivateHeaderKitHelperProtocolTests {
== "a7e5982ed7de5dab5dec76036682ea55825b77a8"
)
#expect(swiftSectionState["version"] == nil)

let machOKitPin = try #require(
pins.first { $0["identity"] as? String == "machokit" }
)
let machOKitState = try #require(
machOKitPin["state"] as? [String: Any]
)
#expect(
machOKitPin["location"] as? String
== "https://github.com/MxIris-Reverse-Engineering/MachOKit.git"
)
#expect(
machOKitState["revision"] as? String
== "e0e0b30187ae74f2088d932845c8ddac2c79f36c"
)
#expect(machOKitState["version"] == nil)

let mirrorData = try Data(
contentsOf: packageRoot
.appendingPathComponent(".swiftpm/configuration/mirrors.json")
)
let mirrorDocument = try #require(
JSONSerialization.jsonObject(with: mirrorData) as? [String: Any]
)
let mirrors = try #require(
mirrorDocument["object"] as? [[String: String]]
)
let expectedMirror = "https://github.com/lynnswap/MachOKit.git"
#expect(Set(mirrors.compactMap { $0["mirror"] }) == [expectedMirror])
#expect(
Set(mirrors.compactMap { $0["original"] }) == [
"https://github.com/MxIris-Reverse-Engineering/MachOKit",
"https://github.com/MxIris-Reverse-Engineering/MachOKit.git",
]
)
}

@Test func inventoryNormalizesImagePathMembershipAndRoundTrips() throws {
Expand Down