mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-1545: De-guava the Debugger
This commit is contained in:
@@ -18,8 +18,6 @@ package agent.gdb.manager.reason;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import agent.gdb.manager.GdbState;
|
||||
import agent.gdb.manager.parsing.GdbMiParser.GdbMiFieldList;
|
||||
import ghidra.util.Msg;
|
||||
@@ -38,13 +36,12 @@ public interface GdbReason {
|
||||
* A map of reason strings to reason classes
|
||||
*/
|
||||
static final Map<String, Function<GdbMiFieldList, ? extends GdbReason>> TYPES =
|
||||
new ImmutableMap.Builder<String, Function<GdbMiFieldList, ? extends GdbReason>>()
|
||||
.put("signal-received", GdbSignalReceivedReason::new)
|
||||
.put("breakpoint-hit", GdbBreakpointHitReason::new)
|
||||
.put("end-stepping-range", GdbEndSteppingRangeReason::new)
|
||||
.put("exited", GdbExitedReason::new)
|
||||
.put("exited-normally", GdbExitNormallyReason::new)
|
||||
.build();
|
||||
Map.ofEntries(
|
||||
Map.entry("signal-received", GdbSignalReceivedReason::new),
|
||||
Map.entry("breakpoint-hit", GdbBreakpointHitReason::new),
|
||||
Map.entry("end-stepping-range", GdbEndSteppingRangeReason::new),
|
||||
Map.entry("exited", GdbExitedReason::new),
|
||||
Map.entry("exited-normally", GdbExitNormallyReason::new));
|
||||
|
||||
/**
|
||||
* Reasons other than those given by GDB
|
||||
|
||||
@@ -29,6 +29,7 @@ import ghidra.dbg.target.schema.TargetAttributeType;
|
||||
import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.ListenerMap.ListenerEntry;
|
||||
import ghidra.util.datastruct.ListenerSet;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@@ -62,8 +63,8 @@ public class GdbModelTargetBreakpointSpec extends
|
||||
protected final ListenerSet<TargetBreakpointAction> actions =
|
||||
new ListenerSet<>(TargetBreakpointAction.class) {
|
||||
// Use strong references on actions
|
||||
protected Map<TargetBreakpointAction, TargetBreakpointAction> createMap() {
|
||||
return Collections.synchronizedMap(new LinkedHashMap<>());
|
||||
protected Map<TargetBreakpointAction, ListenerEntry<? extends TargetBreakpointAction>> createMap() {
|
||||
return new LinkedHashMap<>();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -22,10 +22,6 @@ import java.util.function.Consumer;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import agent.gdb.manager.GdbTable;
|
||||
import agent.gdb.manager.parsing.GdbMiParser.GdbMiFieldList;
|
||||
|
||||
public class GdbTableTest {
|
||||
@@ -35,16 +31,16 @@ public class GdbTableTest {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
protected <K, V> Map<K, V> buildMap(Consumer<ImmutableMap.Builder<K, V>> conf) {
|
||||
ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();
|
||||
protected <K, V> Map<K, V> buildMap(Consumer<Map<K, V>> conf) {
|
||||
Map<K, V> builder = new HashMap<>();
|
||||
conf.accept(builder);
|
||||
return builder.build();
|
||||
return Map.copyOf(builder);
|
||||
}
|
||||
|
||||
protected <E> List<E> buildList(Consumer<ImmutableList.Builder<E>> conf) {
|
||||
ImmutableList.Builder<E> builder = ImmutableList.builder();
|
||||
protected <E> List<E> buildList(Consumer<List<E>> conf) {
|
||||
List<E> builder = new ArrayList<>();
|
||||
conf.accept(builder);
|
||||
return builder.build();
|
||||
return List.copyOf(builder);
|
||||
}
|
||||
|
||||
protected GdbTable buildTestTable() {
|
||||
|
||||
Reference in New Issue
Block a user