GP-4869: Better error handling when dyld subcache files are missing

This commit is contained in:
Ryan Kurtz 2024-08-22 13:42:29 -04:00
parent db28b29dab
commit e45e1e3844

View File

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -157,26 +157,22 @@ public class DyldCacheUtils {
String uuid = subcacheEntry.getUuid(); String uuid = subcacheEntry.getUuid();
String extension = subcacheEntry.getCacheExtension(); String extension = subcacheEntry.getCacheExtension();
FSRL fsrl = uuidToFileMap.get(uuid); FSRL fsrl = uuidToFileMap.get(uuid);
if (fsrl != null) { if (fsrl == null) {
log.appendMsg("Including subcache: " + fsrl.getName() + " - " + uuid); throw new IOException("Missing subcache: %s%s".formatted(
}
else {
log.appendMsg(String.format("Missing subcache: %s%s",
extension != null ? (baseProvider.getName() + extension + " - ") : "", extension != null ? (baseProvider.getName() + extension + " - ") : "",
uuid)); uuid));
} }
log.appendMsg("Including subcache: " + fsrl.getName() + " - " + uuid);
} }
String symbolUUID = baseHeader.getSymbolFileUUID(); String symbolUUID = baseHeader.getSymbolFileUUID();
if (symbolUUID != null) { if (symbolUUID != null) {
FSRL symbolFSRL = uuidToFileMap.get(symbolUUID); FSRL symbolFSRL = uuidToFileMap.get(symbolUUID);
if (symbolFSRL != null) { if (symbolFSRL == null) {
log.appendMsg( throw new IOException("Missing symbols subcache: %s.symbols - %s"
"Including symbols subcache: " + symbolFSRL.getName() + " - " + symbolUUID); .formatted(baseProvider.getName(), symbolUUID));
}
else {
log.appendMsg(String.format("Missing symbols subcache: %s.symbols - %s",
baseProvider.getName(), symbolUUID));
} }
log.appendMsg(
"Including symbols subcache: " + symbolFSRL.getName() + " - " + symbolUUID);
} }
} }