Analysis pulled every export, import and symbol across the wire and then kept the handful that name code -- 87k rows for a kernel, each carrying a type and an address as text. Ask for what it uses instead: the offset, name and source of each function the module knows about, chosen where the rows already are.
25 lines
804 B
Swift
25 lines
804 B
Swift
import Foundation
|
|
|
|
public struct ModuleFunction: Sendable, Hashable {
|
|
public let offset: UInt64
|
|
public let name: String
|
|
public let source: ModuleAnalysis.Function.Source
|
|
|
|
public init(offset: UInt64, name: String, source: ModuleAnalysis.Function.Source) {
|
|
self.offset = offset
|
|
self.name = name
|
|
self.source = source
|
|
}
|
|
|
|
static func fromJSON(_ dict: [String: Any]) -> ModuleFunction? {
|
|
guard let offset = dict["offset"] as? NSNumber,
|
|
let name = dict["name"] as? String,
|
|
let source = dict["source"] as? String,
|
|
let kind = ModuleAnalysis.Function.Source(rawValue: source)
|
|
else {
|
|
return nil
|
|
}
|
|
return ModuleFunction(offset: offset.uint64Value, name: name, source: kind)
|
|
}
|
|
}
|