Skip to content

Commit

Permalink
Minor pokes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddTheSane committed Oct 8, 2023
1 parent 656e6f2 commit 736c0a9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Other Sources/ADBToolkit/ADBSwiftHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ extension ADBBinCueImage {
extension BXFileTypes {
/// Returns the executable type of the file at the specified URL.
/// If the executable type cannot be determined, this method will throw.
static func typeOfExecutable(at URL: URL) throws -> BXExecutableType {
static func typeOfExecutable(at url: URL) throws -> BXExecutableType {
let handle: ADBFileHandle
do {
handle = try ADBFileHandle(url: URL, options: .openForReading)
handle = try ADBFileHandle(url: url, options: .openForReading)
} catch {
throw BXExecutableTypesErrors(.couldNotReadExecutable, userInfo: [NSUnderlyingErrorKey: error])
throw BXExecutableTypesErrors(.couldNotReadExecutable, userInfo: [NSUnderlyingErrorKey: error,
NSURLErrorKey: url])
}
defer {
handle.close()
Expand Down
33 changes: 32 additions & 1 deletion Other Sources/ADBToolkit/NSError+ADBErrorHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,38 @@ private let cxxPrefixes = ["_Z"]

private let ADBCallstackSymbolPattern = #"^\d+\s+(\S+)\s+(0x[a-fA-F0-9]+)\s+(.+)\s+\+\s+(\d+)$"#
@available(macOS 13.0, *)
private let ADBCallstackSymbolPatternNew = /^\d+\s+(\S+)\s+0x([a-fA-F0-9]+)\s+(.+)\s+\+\s+(\d+)$/
private let ADBCallstackSymbolPatternNew = Regex {
/^/
OneOrMore(.digit)
OneOrMore(.whitespace)
Capture {
OneOrMore(.whitespace.inverted)
}
OneOrMore(.whitespace)
"0x"
Capture {
OneOrMore {
CharacterClass(
("a"..."f"),
("A"..."F"),
("0"..."9")
)
}
}
OneOrMore(.whitespace)
Capture {
OneOrMore {
/./
}
}
OneOrMore(.whitespace)
"+"
OneOrMore(.whitespace)
Capture {
OneOrMore(.digit)
}
/$/
}

extension NSException {
private static func possibleMangledType(from: String) -> MangledFunctionType {
Expand Down

0 comments on commit 736c0a9

Please sign in to comment.