Skip to content

Commit

Permalink
Cleanup process name matching
Browse files Browse the repository at this point in the history
  • Loading branch information
inket committed Aug 26, 2024
1 parent afb31b6 commit f528e8f
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions MacSymbolicator/Models/ReportProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,23 @@ public class ReportProcess {

return processSections.compactMap {
guard let match = $0.first else { return nil }
return ReportProcess(parsing: match, targetProcess: targetProcess)
}
}

init?(parsing content: String, targetProcess: String?) {
name = content.scan(pattern: Self.processNameRegex).first?.first
if (name == nil) {
return nil;
}
if (!(targetProcess ?? "").isEmpty) {
if (!name!.contains(targetProcess!)) {
return nil;
let processName = match.scan(pattern: Self.processNameRegex).first?.first

if let targetProcess {
if let processName, processName.contains(targetProcess) {
return ReportProcess(name: processName, parsing: match)
} else {
return nil
}
} else {
return ReportProcess(name: processName, parsing: match)
}
}
}

init?(name: String?, parsing content: String) {
self.name = name
architecture = Architecture.find(in: content)
binaryImages = BinaryImage.find(in: content)
frames = StackFrame.find(
Expand Down

0 comments on commit f528e8f

Please sign in to comment.