Ghidra is a software reverse engineering (SRE) framework
GP-0: Improve DBTrace error reporting. Permit "upgrade" of gzt-contained DataTypeManager.
Dan8a3dc4e7c99e
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/ManagedDomainObject.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/ManagedDomainObject.javaindex d1423faea1..48f6f3d087 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/ManagedDomainObject.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/ManagedDomainObject.java@@ -50,7 +50,7 @@ public class ManagedDomainObject<T extends DomainObject> implements AutoCloseablpublic ManagedDomainObject(DomainFile file, Class<T> type, TaskMonitor monitor)throws VersionException, CancelledException, IOException {- state.obj = type.cast(file.getDomainObject(state, false, false, monitor));+ state.obj = type.cast(file.getDomainObject(state, true, false, monitor));CLEANER.register(this, state);}diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceConstructor.java b/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceConstructor.javaindex d32182fad2..2038f907bc 100644--- a/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceConstructor.java+++ b/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceConstructor.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -40,7 +40,10 @@ class DependentServiceConstructor<T> {List<Object> params = new ArrayList<>(method.getParameterCount());for (Class<?> pType : method.getParameterTypes()) {Object p = dependencies.get(pType);- assert p != null;+ if (p == null) {+ throw new AssertionError("Could not find a %s while invoking %s".formatted(+ pType, method));+ }params.add(p);}try {diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceResolver.java b/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceResolver.javaindex 71431d8d3f..b8310c4768 100644--- a/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceResolver.java+++ b/Ghidra/Debug/ProposedUtils/src/main/java/generic/depends/DependentServiceResolver.java@@ -82,14 +82,14 @@ public class DependentServiceResolver<T> {throw new IllegalArgumentException("Overridden constructor must return same or subclass of original");}- depsByDependents.computeIfAbsent(override, o -> new HashSet<>()).add(rCls);+ depsByDependents.computeIfAbsent(override, _ -> new HashSet<>()).add(rCls);constructors.put(override, m);}constructors.put(rCls, m);m.setAccessible(true);for (Class<?> pType : m.getParameterTypes()) {- depsByDependents.computeIfAbsent(rCls, c -> new HashSet<>()).add(pType);+ depsByDependents.computeIfAbsent(rCls, _ -> new HashSet<>()).add(pType);}}for (Field f : cls.getDeclaredFields()) {@@ -98,7 +98,7 @@ public class DependentServiceResolver<T> {continue;}Class<?> fCls = f.getType();- fieldsByClass.computeIfAbsent(fCls, c -> new HashSet<>()).add(f);+ fieldsByClass.computeIfAbsent(fCls, _ -> new HashSet<>()).add(f);f.setAccessible(true);}}@@ -141,6 +141,10 @@ public class DependentServiceResolver<T> {Object service = constructed.get(cons.method);if (service == null) {service = cons.construct(obj, instancesByClass);+ if (service == null) {+ throw new NullPointerException(+ "ServiceConstructor %s returned null".formatted(cons.method));+ }constructed.put(cons.method, service);}instancesByClass.put(cons.cls, service);diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/data/DBDomainObjectSupport.java b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/data/DBDomainObjectSupport.javaindex 3e1bb264a0..e1189a7106 100644--- a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/data/DBDomainObjectSupport.java+++ b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/data/DBDomainObjectSupport.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -64,6 +64,12 @@ public abstract class DBDomainObjectSupport extends DomainObjectAdapterDB {catch (UnsatisfiedParameterException | UnsatisfiedFieldsException e) {throw new AssertionError(e);}+ catch (NullPointerException e) {+ if (versionExc != null) {+ throw versionExc;+ }+ throw e;+ }if (versionExc != null) {throw versionExc;}