GP-2772: Refactor Modules/Sections provider for new trace convention

This commit is contained in:
Dan 2022-11-08 14:12:57 -05:00
parent 5e89b1a886
commit 12f5365d40
34 changed files with 3091 additions and 1119 deletions

View file

@ -54,8 +54,7 @@ import ghidra.trace.database.symbol.*;
import ghidra.trace.database.target.DBTraceObjectManager;
import ghidra.trace.database.thread.DBTraceThreadManager;
import ghidra.trace.database.time.DBTraceTimeManager;
import ghidra.trace.model.Lifespan;
import ghidra.trace.model.Trace;
import ghidra.trace.model.*;
import ghidra.trace.model.memory.TraceMemoryRegion;
import ghidra.trace.model.program.TraceProgramView;
import ghidra.trace.model.property.TraceAddressPropertyManager;
@ -67,8 +66,7 @@ import ghidra.trace.util.TraceChangeRecord;
import ghidra.util.*;
import ghidra.util.database.*;
import ghidra.util.datastruct.ListenerSet;
import ghidra.util.exception.CancelledException;
import ghidra.util.exception.VersionException;
import ghidra.util.exception.*;
import ghidra.util.task.TaskMonitor;
// TODO: Need some subscription model to ensure record lifespans stay within lifespan of threads
@ -219,6 +217,14 @@ public class DBTrace extends DBCachedDomainObjectAdapter implements Trace, Trace
}
}
@Override
public void dbError(IOException e) {
if (e instanceof ClosedException) {
throw new TraceClosedException(e);
}
super.dbError(e);
}
protected void fixedProgramViewRemoved(RemovalNotification<Long, DBTraceProgramView> rn) {
Msg.debug(this, "Dropped cached fixed view at snap=" + rn.getKey());
}

View file

@ -16,6 +16,7 @@
package ghidra.trace.database.module;
import ghidra.dbg.target.*;
import ghidra.dbg.util.PathUtils;
import ghidra.program.model.address.AddressRange;
import ghidra.trace.database.target.DBTraceObject;
import ghidra.trace.database.target.DBTraceObjectInterface;
@ -109,8 +110,10 @@ public class DBTraceObjectSection implements TraceObjectSection, DBTraceObjectIn
@Override
public String getName() {
String key = object.getCanonicalPath().key();
String index = PathUtils.isIndex(key) ? PathUtils.parseIndex(key) : key;
return TraceObjectInterfaceUtils.getValue(object, computeMinSnap(),
TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, "");
TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, index);
}
@Override

View file

@ -79,7 +79,6 @@ public class DBTraceProgramViewMemory extends AbstractDBTraceProgramViewMemory {
// TODO: Performance test this
forVisibleRegions(reg -> temp.add(reg.getRange()));
addressSet = temp;
System.err.println("Recomputed: " + temp);
}
protected MemoryBlock getRegionBlock(TraceMemoryRegion region) {

View file

@ -0,0 +1,24 @@
/* ###
* IP: GHIDRA
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.trace.model;
import ghidra.framework.model.DomainObjectException;
public class TraceClosedException extends DomainObjectException {
public TraceClosedException(Throwable t) {
super(t);
}
}