mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch 'origin/GP-3087_Dan_excludeExternalInEmulation--SQUASHED'
This commit is contained in:
commit
0565d03e69
8 changed files with 113 additions and 63 deletions
|
@ -112,6 +112,13 @@ public class DBTraceStaticMapping extends DBAnnotatedObject
|
|||
this.manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"Mapping: dynamic=%s,program=%s,address=%s,length=0x%x,shift=0x%x,lifespan=%s",
|
||||
traceAddress, staticProgramURL, staticAddress, length, shift, lifespan);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fresh(boolean created) throws IOException {
|
||||
if (created) {
|
||||
|
|
|
@ -85,8 +85,9 @@ public class DBTraceStaticMappingManager implements TraceStaticMappingManager, D
|
|||
DBTraceStaticMapping conflict =
|
||||
findAnyConflicting(range, lifespan, toProgramURL, toAddress);
|
||||
if (conflict != null) {
|
||||
// TODO: Find all conflicts?
|
||||
throw new TraceConflictedMappingException("Another mapping would conflict",
|
||||
conflict);
|
||||
Set.of(conflict));
|
||||
}
|
||||
// TODO: A more sophisticated coverage check?
|
||||
// TODO: Better coalescing
|
||||
|
@ -133,8 +134,7 @@ public class DBTraceStaticMappingManager implements TraceStaticMappingManager, D
|
|||
|
||||
@Override
|
||||
public DBTraceStaticMapping findAnyConflicting(AddressRange range, Lifespan lifespan,
|
||||
URL toProgramURL,
|
||||
String toAddress) {
|
||||
URL toProgramURL, String toAddress) {
|
||||
for (DBTraceStaticMapping mapping : mappingsByAddress.head(range.getMaxAddress(),
|
||||
true).descending().values()) {
|
||||
if (!mapping.conflictsWith(range, lifespan, toProgramURL, toAddress)) {
|
||||
|
|
|
@ -15,15 +15,19 @@
|
|||
*/
|
||||
package ghidra.trace.model.modules;
|
||||
|
||||
public class TraceConflictedMappingException extends Exception {
|
||||
private final TraceStaticMapping conflict;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
public TraceConflictedMappingException(String message, TraceStaticMapping conflict) {
|
||||
super(message);
|
||||
this.conflict = conflict;
|
||||
public class TraceConflictedMappingException extends RuntimeException {
|
||||
private final Set<TraceStaticMapping> conflicts;
|
||||
|
||||
public TraceConflictedMappingException(String message,
|
||||
Collection<TraceStaticMapping> conflicts) {
|
||||
super(message + ": " + conflicts);
|
||||
this.conflicts = Set.copyOf(conflicts);
|
||||
}
|
||||
|
||||
public TraceStaticMapping getConflict() {
|
||||
return conflict;
|
||||
public Set<TraceStaticMapping> getConflicts() {
|
||||
return conflicts;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue