mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-08-17 10:42:27 +08:00
GP-7104: Deprecated fixes
This commit is contained in:
+27
-27
@@ -18,7 +18,7 @@ package ghidra.app.plugin.core.debug.gui.modules;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URI;
|
||||
import java.util.*;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -64,9 +64,9 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
traceManager.openTrace(tb.trace);
|
||||
traceManager.activateTrace(tb.trace);
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "DEADBEEF");
|
||||
new URI("ghidra://static").toURL(), "DEADBEEF");
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
|
||||
@@ -74,7 +74,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
assertEquals(1, displayed.size());
|
||||
StaticMappingRow record = displayed.get(0);
|
||||
assertEquals(tb.addr(0xdeadbeef), record.getTraceAddress());
|
||||
assertEquals(new URL("ghidra://static"), record.getStaticProgramURL());
|
||||
assertEquals(new URI("ghidra://static").toURL(), record.getStaticProgramURL());
|
||||
assertEquals("DEADBEEF", record.getStaticAddress());
|
||||
assertEquals(0x100, record.getLength());
|
||||
}
|
||||
@@ -84,9 +84,9 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
traceManager.openTrace(tb.trace);
|
||||
// Note: don't activate yet
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "DEADBEEF");
|
||||
new URI("ghidra://static").toURL(), "DEADBEEF");
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
assertEquals(1, displayed.size());
|
||||
StaticMappingRow record = displayed.get(0);
|
||||
assertEquals(tb.addr(0xdeadbeef), record.getTraceAddress());
|
||||
assertEquals(new URL("ghidra://static"), record.getStaticProgramURL());
|
||||
assertEquals(new URI("ghidra://static").toURL(), record.getStaticProgramURL());
|
||||
assertEquals("DEADBEEF", record.getStaticAddress());
|
||||
assertEquals(0x100, record.getLength());
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
intoProject(tb.trace);
|
||||
intoProject(program);
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
tb.createRootObject("Target");
|
||||
tb.trace.getMemoryManager()
|
||||
.addRegion("Memory[.text]", Lifespan.nowOn(0),
|
||||
@@ -123,7 +123,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
|
||||
try (Transaction tx = program.openTransaction("Add block")) {
|
||||
try (Transaction _ = program.openTransaction("Add block")) {
|
||||
program.getMemory()
|
||||
.createInitializedBlock(".text", addr(program, 0xc0de1234L), 0x100, (byte) 0,
|
||||
TaskMonitor.DUMMY, false);
|
||||
@@ -163,13 +163,13 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
traceManager.openTrace(tb.trace);
|
||||
traceManager.activateTrace(tb.trace);
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "DEADBEEF");
|
||||
new URI("ghidra://static").toURL(), "DEADBEEF");
|
||||
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "C0DE1234");
|
||||
new URI("ghidra://static").toURL(), "C0DE1234");
|
||||
manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "1E55C0DE");
|
||||
new URI("ghidra://static").toURL(), "1E55C0DE");
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
|
||||
@@ -204,13 +204,13 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
traceManager.openTrace(tb.trace);
|
||||
traceManager.activateTrace(tb.trace);
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "DEADBEEF");
|
||||
new URI("ghidra://static").toURL(), "DEADBEEF");
|
||||
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "C0DE1234");
|
||||
new URI("ghidra://static").toURL(), "C0DE1234");
|
||||
manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "1E55C0DE");
|
||||
new URI("ghidra://static").toURL(), "1E55C0DE");
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
|
||||
@@ -219,7 +219,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
assertEquals(3, displayed.size());
|
||||
|
||||
// Remove the first two in another transaction
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.findContaining(tb.addr(0xdeadbeef), 0).delete();
|
||||
manager.findContaining(tb.addr(0xdeadbeef + 0x100), 0).delete();
|
||||
}
|
||||
@@ -237,16 +237,16 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
traceManager.openTrace(tb.trace);
|
||||
traceManager.activateTrace(tb.trace);
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "DEADBEEF");
|
||||
new URI("ghidra://static").toURL(), "DEADBEEF");
|
||||
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "C0DE1234");
|
||||
new URI("ghidra://static").toURL(), "C0DE1234");
|
||||
}
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "1E55C0DE");
|
||||
new URI("ghidra://static").toURL(), "1E55C0DE");
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
|
||||
@@ -264,16 +264,16 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
|
||||
traceManager.openTrace(tb.trace);
|
||||
traceManager.activateTrace(tb.trace);
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
try (Transaction _ = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "DEADBEEF");
|
||||
new URI("ghidra://static").toURL(), "DEADBEEF");
|
||||
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "C0DE1234");
|
||||
new URI("ghidra://static").toURL(), "C0DE1234");
|
||||
}
|
||||
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0),
|
||||
new URL("ghidra://static"), "1E55C0DE");
|
||||
new URI("ghidra://static").toURL(), "1E55C0DE");
|
||||
waitForDomainObject(tb.trace);
|
||||
|
||||
// Check that all records are displayed in the interim
|
||||
|
||||
+1
-6
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package ghidra.trace.database.guest;
|
||||
|
||||
import static ghidra.lifecycle.Unfinished.TODO;
|
||||
import static ghidra.lifecycle.Unfinished.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -209,11 +209,6 @@ public class DBTraceGuestPlatformMappedMemory implements Memory {
|
||||
return TODO();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressSetView getInitializedAddressSet() {
|
||||
return TODO();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressSetView getExecuteSet() {
|
||||
return TODO();
|
||||
|
||||
-5
@@ -124,11 +124,6 @@ public abstract class AbstractDBTraceProgramViewMemory
|
||||
return getOrComputeAddressSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressSetView getInitializedAddressSet() {
|
||||
return getOrComputeAddressSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBigEndian() {
|
||||
return program.getLanguage().isBigEndian();
|
||||
|
||||
+3
-3
@@ -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.
|
||||
@@ -110,7 +110,7 @@ public class PrivatelyQueuedListener<P> {
|
||||
*/
|
||||
public PrivatelyQueuedListener(Class<P> iface, String threadNamePattern, P out) {
|
||||
this(iface, Executors.newSingleThreadExecutor(
|
||||
new BasicThreadFactory.Builder().namingPattern(threadNamePattern).build()), out);
|
||||
BasicThreadFactory.builder().namingPattern(threadNamePattern).build()), out);
|
||||
}
|
||||
|
||||
public void setErrorHandler(ListenerErrorHandler errorHandler) {
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.ComponentProvider;
|
||||
@@ -165,7 +165,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
||||
GraphViewer<SampleVertex, SampleEdge> viewer = view.getPrimaryGraphViewer();
|
||||
|
||||
Predicate<SampleVertex> filter =
|
||||
v -> StringUtils.containsIgnoreCase(v.getName(), filterText);
|
||||
v -> Strings.CI.contains(v.getName(), filterText);
|
||||
FilterVerticesJob<SampleVertex, SampleEdge> job =
|
||||
new FilterVerticesJob<>(viewer, graph, filter, remove);
|
||||
|
||||
|
||||
+8
-7
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package ghidra.features.bsim.query;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.*;
|
||||
|
||||
import ghidra.features.bsim.query.client.PostgresFunctionDatabase;
|
||||
import ghidra.features.bsim.query.elastic.ElasticDatabase;
|
||||
@@ -34,9 +33,10 @@ public class BSimClientFactory {
|
||||
* @param urlString the URL to build
|
||||
* @return the parsed URL object
|
||||
* @throws MalformedURLException if the URL string cannot be parsed
|
||||
* @throws URISyntaxException if the URL string cannot be parsed
|
||||
*/
|
||||
public static URL buildURL(String urlString) throws MalformedURLException {
|
||||
URL url = new URL(urlString);
|
||||
public static URL buildURL(String urlString) throws MalformedURLException, URISyntaxException {
|
||||
URL url = new URI(urlString).toURL();
|
||||
checkBSimServerURL(url);
|
||||
return url;
|
||||
}
|
||||
@@ -73,11 +73,12 @@ public class BSimClientFactory {
|
||||
* @param urlString is the "related" URL
|
||||
* @return the root BSim URL
|
||||
* @throws MalformedURLException if the given URL string cannot be parsed
|
||||
* @throws URISyntaxException if the given URL string cannot be parsed
|
||||
* @throws IllegalArgumentException if local ghidra URL is specified
|
||||
*/
|
||||
public static URL deriveBSimURL(String urlString)
|
||||
throws IllegalArgumentException, MalformedURLException {
|
||||
URL url = new URL(urlString); // URL used only for parsing purposes
|
||||
throws IllegalArgumentException, MalformedURLException, URISyntaxException {
|
||||
URL url = new URI(urlString).toURL(); // URL used only for parsing purposes
|
||||
String protocol = url.getProtocol();
|
||||
if ("postgresql".equals(protocol) || "https".equals(protocol) ||
|
||||
"elastic".equals(protocol) || "file".equals(protocol)) {
|
||||
@@ -130,7 +131,7 @@ public class BSimClientFactory {
|
||||
try {
|
||||
return buildClient(bsimServerInfo.toURL(), async);
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
catch (MalformedURLException | URISyntaxException e) {
|
||||
throw new RuntimeException(e); // unexpected
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class BSimPostgresDBConnectionManager {
|
||||
info -> new BSimPostgresDataSource(info));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Deprecated(since = "11.0", forRemoval = true)
|
||||
public static BSimPostgresDataSource getDataSource(URL postgresUrl) {
|
||||
return getDataSource(new BSimServerInfo(postgresUrl));
|
||||
}
|
||||
|
||||
@@ -352,9 +352,10 @@ public class BSimServerInfo implements Comparable<BSimServerInfo> {
|
||||
* Warning: If userinfo with password has been specified it will be returned in the URL.
|
||||
* @return BSim server info in URL
|
||||
* @throws MalformedURLException if unable to form supported URL
|
||||
* @throws URISyntaxException if unable to form supported URL
|
||||
*/
|
||||
public URL toURL() throws MalformedURLException {
|
||||
return new URL(toURLString());
|
||||
public URL toURL() throws MalformedURLException, URISyntaxException {
|
||||
return new URI(toURLString()).toURL();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -178,7 +178,7 @@ public interface FunctionDatabase extends AutoCloseable {
|
||||
*/
|
||||
public BSimServerInfo getServerInfo();
|
||||
|
||||
@Deprecated
|
||||
@Deprecated(since = "11.0")
|
||||
public String getURLString();
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public final class PostgresFunctionDatabase
|
||||
new CachedStatement<>();
|
||||
|
||||
public PostgresFunctionDatabase(URL postgresUrl, boolean async) {
|
||||
super(BSimPostgresDBConnectionManager.getDataSource(postgresUrl),
|
||||
super(BSimPostgresDBConnectionManager.getDataSource(new BSimServerInfo(postgresUrl)),
|
||||
FunctionDatabase.generateLSHVectorFactory(), LAYOUT_VERSION);
|
||||
postgresDs = (BSimPostgresDataSource) ds;
|
||||
asynchronous = async;
|
||||
|
||||
+25
-8
@@ -16,8 +16,7 @@
|
||||
package ghidra.features.bsim.query.elastic;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.*;
|
||||
|
||||
import com.google.gson.*;
|
||||
|
||||
@@ -188,7 +187,7 @@ public class ElasticConnection {
|
||||
throws ElasticException {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL httpURL = new URL(hostURL + path);
|
||||
URL httpURL = new URI(hostURL + path).toURL();
|
||||
connection = (HttpURLConnection) httpURL.openConnection();
|
||||
connection.setRequestMethod(command);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
@@ -203,6 +202,9 @@ public class ElasticConnection {
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new ElasticException("Error parsing URL: " + e.getMessage());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ElasticException("Error sending request: " + e.getMessage());
|
||||
}
|
||||
@@ -228,7 +230,7 @@ public class ElasticConnection {
|
||||
throws ElasticException {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL httpURL = new URL(httpURLbase + path);
|
||||
URL httpURL = new URI(httpURLbase + path).toURL();
|
||||
connection = (HttpURLConnection) httpURL.openConnection();
|
||||
connection.setRequestMethod(command);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
@@ -242,6 +244,9 @@ public class ElasticConnection {
|
||||
throw new ElasticException(parseErrorJSON(resp));
|
||||
}
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new ElasticException("Error parsing URL: " + e.getMessage());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ElasticException("Error sending request: " + e.getMessage());
|
||||
}
|
||||
@@ -267,7 +272,7 @@ public class ElasticConnection {
|
||||
throws ElasticException {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL httpURL = new URL(httpURLbase + path);
|
||||
URL httpURL = new URI(httpURLbase + path).toURL();
|
||||
connection = (HttpURLConnection) httpURL.openConnection();
|
||||
connection.setRequestMethod(command);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
@@ -282,6 +287,9 @@ public class ElasticConnection {
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new ElasticException("Error parsing URL: " + e.getMessage());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ElasticException("Error sending request: " + e.getMessage());
|
||||
}
|
||||
@@ -308,7 +316,7 @@ public class ElasticConnection {
|
||||
throws ElasticException {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL httpURL = new URL(httpURLbase + path);
|
||||
URL httpURL = new URI(httpURLbase + path).toURL();
|
||||
connection = (HttpURLConnection) httpURL.openConnection();
|
||||
connection.setRequestMethod(command);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
@@ -320,6 +328,9 @@ public class ElasticConnection {
|
||||
JsonObject resp = grabResponse(connection);
|
||||
return resp;
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new ElasticException("Error parsing URL: " + e.getMessage());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ElasticException("Error sending request: " + e.getMessage());
|
||||
}
|
||||
@@ -344,7 +355,7 @@ public class ElasticConnection {
|
||||
public JsonObject executeBulk(String path, String body) throws ElasticException {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL httpURL = new URL(hostURL + path);
|
||||
URL httpURL = new URI(hostURL + path).toURL();
|
||||
connection = (HttpURLConnection) httpURL.openConnection();
|
||||
connection.setRequestMethod(POST);
|
||||
connection.setRequestProperty("Content-Type", "application/x-ndjson");
|
||||
@@ -359,6 +370,9 @@ public class ElasticConnection {
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new ElasticException("Error parsing URL: " + e.getMessage());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ElasticException("Error sending request: " + e.getMessage());
|
||||
}
|
||||
@@ -375,7 +389,7 @@ public class ElasticConnection {
|
||||
public JsonObject executeURIOnly(String command, String path) throws ElasticException {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL httpURL = new URL(httpURLbase + path);
|
||||
URL httpURL = new URI(httpURLbase + path).toURL();
|
||||
connection = (HttpURLConnection) httpURL.openConnection();
|
||||
connection.setRequestMethod(command);
|
||||
connection.setDoOutput(true);
|
||||
@@ -386,6 +400,9 @@ public class ElasticConnection {
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new ElasticException("Error parsing URL: " + e.getMessage());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ElasticException("Error sending request: " + e.getMessage());
|
||||
}
|
||||
|
||||
+4
-4
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package ghidra.features.bsim.query.facade;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.*;
|
||||
import java.util.Set;
|
||||
|
||||
import generic.lsh.vector.LSHVectorFactory;
|
||||
@@ -415,7 +414,8 @@ public class SimilarFunctionQueryService implements AutoCloseable {
|
||||
}
|
||||
|
||||
// NOTE: Method overriden for testing
|
||||
protected FunctionDatabase createDatabase(String urlString) throws MalformedURLException {
|
||||
protected FunctionDatabase createDatabase(String urlString)
|
||||
throws MalformedURLException, URISyntaxException {
|
||||
URL url = BSimClientFactory.deriveBSimURL(urlString);
|
||||
return BSimClientFactory.buildClient(url, false);
|
||||
}
|
||||
@@ -435,7 +435,7 @@ public class SimilarFunctionQueryService implements AutoCloseable {
|
||||
try {
|
||||
database = createDatabase(serverURLString);
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
catch (MalformedURLException | URISyntaxException e) {
|
||||
throw new QueryDatabaseException("Bad database URL: " + e.getMessage());
|
||||
}
|
||||
boolean success = database.initialize();
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class H2FileFunctionDatabase extends AbstractSQLFunctionDatabase<Base64Ve
|
||||
* @param bsimURL local file URL for H2 database
|
||||
*/
|
||||
public H2FileFunctionDatabase(URL bsimURL) {
|
||||
this(BSimH2FileDBConnectionManager.getDataSource(bsimURL));
|
||||
this(BSimH2FileDBConnectionManager.getDataSource(new BSimServerInfo(bsimURL)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-2
@@ -244,10 +244,11 @@ public class BSimLaunchable implements GhidraLaunchable {
|
||||
* @param ghidraURLString is the URL string for the ghidra server
|
||||
* @param bsimURLString is the URL string for the bsim server
|
||||
* @throws MalformedURLException if there is a problem parsing the given URLs
|
||||
* @throws URISyntaxException if there is a problem parsing the given URLs
|
||||
* @throws IllegalArgumentException if unsupported URL use occurs
|
||||
*/
|
||||
private void setupURLs(String ghidraURLString, String bsimURLString)
|
||||
throws MalformedURLException {
|
||||
throws MalformedURLException, URISyntaxException {
|
||||
|
||||
if (ghidraURLString != null) {
|
||||
setupGhidraURL(ghidraURLString);
|
||||
@@ -493,7 +494,7 @@ public class BSimLaunchable implements GhidraLaunchable {
|
||||
}
|
||||
|
||||
private void processSigAndUpdateOptions(String urlstring)
|
||||
throws IllegalArgumentException, MalformedURLException {
|
||||
throws IllegalArgumentException, MalformedURLException, URISyntaxException {
|
||||
String bsimURLOption = optionValueMap.get(BSIM_URL_OPTION);
|
||||
String configOption = optionValueMap.get(CONFIG_OPTION);
|
||||
if (configOption != null) {
|
||||
|
||||
+3
-4
@@ -16,8 +16,7 @@
|
||||
package ghidra.features.bsim.query.facade;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.*;
|
||||
|
||||
import generic.jar.ResourceFile;
|
||||
import generic.lsh.vector.LSHVectorFactory;
|
||||
@@ -114,9 +113,9 @@ public class FunctionDatabaseTestDouble implements SQLFunctionDatabase {
|
||||
@Override
|
||||
public BSimServerInfo getServerInfo() {
|
||||
try {
|
||||
return new BSimServerInfo(new URL(urlString));
|
||||
return new BSimServerInfo(new URI(urlString).toURL());
|
||||
}
|
||||
catch (IllegalArgumentException | MalformedURLException e) {
|
||||
catch (IllegalArgumentException | MalformedURLException | URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="ghidra.Ghidra"/>
|
||||
<listAttribute key="org.eclipse.jdt.launching.MODULEPATH"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Framework Utility"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.app.util.headless.AnalyzeHeadless"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.app.util.headless.AnalyzeHeadless c:\users\rmkurtz\ghidra_projects Test -prescript HelloWorldScript.java"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Framework Utility"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8 -Djava.awt.headless=true -Djavax.xml.accessExternalDTD= -Djavax.xml.accessExternalSchema= -Djavax.xml.accessExternalStylesheet= --enable-native-access=ALL-UNNAMED --sun-misc-unsafe-memory-access=allow -XX:+UseCompactObjectHeaders"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ public class SubsToFuncsScript extends GhidraScript {
|
||||
BlockModelService blockModelService = state.getTool().getService(BlockModelService.class);
|
||||
Listing listing = currentProgram.getListing();
|
||||
StringBuffer errorBuf = new StringBuffer();
|
||||
CodeBlockModel cbm = blockModelService.getActiveSubroutineModel();
|
||||
CodeBlockModel cbm = blockModelService.getActiveSubroutineModel(currentProgram);
|
||||
AddressSetView addrset =
|
||||
currentSelection == null ? (AddressSetView) currentProgram.getMemory()
|
||||
: currentSelection;
|
||||
|
||||
@@ -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.
|
||||
@@ -57,23 +57,6 @@ public class SetExternalRefCmd implements Command<Program> {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new command for adding an external reference from data using {@link RefType#DATA}.
|
||||
* @param fromAddr from address (source of the reference)
|
||||
* @param opIndex operand index
|
||||
* @param extName name of external program
|
||||
* @param extLabel label within the external program, may be null if extAddr is not null
|
||||
* @param extAddr address within the external program, may be null
|
||||
* @param source the source of this reference
|
||||
* @deprecated the other constructor form should be used with an appropriate RefType specified.
|
||||
* {@link RefType#DATA} should be used for address table pointer references.
|
||||
*/
|
||||
@Deprecated
|
||||
public SetExternalRefCmd(Address fromAddr, int opIndex, String extName, String extLabel,
|
||||
Address extAddr, SourceType source) {
|
||||
this(fromAddr, opIndex, extName, extLabel, extAddr, RefType.DATA, source);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see ghidra.framework.cmd.Command#applyTo(ghidra.framework.model.DomainObject)
|
||||
|
||||
+5
-4
@@ -21,6 +21,7 @@ import java.util.*;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
|
||||
import ghidra.app.merge.*;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
@@ -3075,9 +3076,9 @@ public class DataTypeMergeManager implements MergeResolver {
|
||||
String latestName = latestSourceArchive.getName();
|
||||
String myName = mySourceArchive.getName();
|
||||
|
||||
boolean sameName = StringUtils.equals(myName, latestName);
|
||||
boolean latestChangedName = !StringUtils.equals(origName, latestName);
|
||||
boolean myChangedName = !StringUtils.equals(origName, myName);
|
||||
boolean sameName = Strings.CS.equals(myName, latestName);
|
||||
boolean latestChangedName = !Strings.CS.equals(origName, latestName);
|
||||
boolean myChangedName = !Strings.CS.equals(origName, myName);
|
||||
// Neither removed the source archive so see what changed.
|
||||
if (!sameName && latestChangedName && myChangedName) {
|
||||
archiveConflictList.add(myChangeIDObject);
|
||||
@@ -3104,7 +3105,7 @@ public class DataTypeMergeManager implements MergeResolver {
|
||||
if (myAddID == latestAddID) {
|
||||
SourceArchive latestSourceArchive =
|
||||
dtms[LATEST].getSourceArchive(new UniversalID(latestAddID));
|
||||
if (!StringUtils.equals(mySourceArchive.getName(),
|
||||
if (!Strings.CS.equals(mySourceArchive.getName(),
|
||||
latestSourceArchive.getName())) {
|
||||
archiveConflictList.add(Long.valueOf(myAddID));
|
||||
foundConflict = true;
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
|
||||
import docking.widgets.dialogs.ReadTextDialog;
|
||||
import generic.stl.Pair;
|
||||
@@ -750,10 +750,10 @@ abstract class AbstractFunctionMerger implements ListingMergeConstants {
|
||||
if (!f1Parms[i].isEquivalent(f2Parms[i])) {
|
||||
return false;
|
||||
}
|
||||
if (!StringUtils.equals(f1Parms[i].getName(), f2Parms[i].getName())) {
|
||||
if (!Strings.CS.equals(f1Parms[i].getName(), f2Parms[i].getName())) {
|
||||
return false;
|
||||
}
|
||||
if (!StringUtils.equals(f1Parms[i].getComment(), f2Parms[i].getComment())) {
|
||||
if (!Strings.CS.equals(f1Parms[i].getComment(), f2Parms[i].getComment())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -112,7 +112,7 @@ public class NavigationUtils {
|
||||
return;
|
||||
}
|
||||
Function extFunc = (Function) s.getObject();
|
||||
Address[] thunkAddrs = extFunc.getFunctionThunkAddresses();
|
||||
Address[] thunkAddrs = extFunc.getFunctionThunkAddresses(false);
|
||||
if (thunkAddrs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PefAnalyzer extends AbstractAnalyzer {
|
||||
Listing listing = program.getListing();
|
||||
ReferenceManager referenceManager = program.getReferenceManager();
|
||||
Symbol tocSymbol = SymbolUtilities.getExpectedLabelOrFunctionSymbol(program,
|
||||
PefConstants.TOC, err -> log.error(getName(), err));
|
||||
PefConstants.TOC, err -> log.appendMsg(getName() + ": " + err));
|
||||
if (tocSymbol == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+4
-4
@@ -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.
|
||||
@@ -17,7 +17,7 @@ package ghidra.app.plugin.core.datamgr;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.data.DataTypeManager;
|
||||
@@ -194,7 +194,7 @@ public class DataTypeSyncInfo {
|
||||
if (!DataTypeSynchronizer.namesAreEquivalent(sourceDt, refDt)) {
|
||||
return true;
|
||||
}
|
||||
if (!StringUtils.equals(refDt.getDescription(), sourceDt.getDescription())) {
|
||||
if (!Strings.CS.equals(refDt.getDescription(), sourceDt.getDescription())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -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.
|
||||
@@ -22,7 +22,7 @@ import java.util.function.Consumer;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import ghidra.app.plugin.core.datamgr.archive.DataTypeManagerHandler;
|
||||
@@ -124,7 +124,7 @@ public class DataTypeSynchronizer {
|
||||
if (!namesAreEquivalent(refDT, sourceDT)) {
|
||||
renameDataType(sourceDTM, sourceDT, refDT);
|
||||
}
|
||||
if (!StringUtils.equals(refDT.getDescription(), sourceDT.getDescription())) {
|
||||
if (!Strings.CS.equals(refDT.getDescription(), sourceDT.getDescription())) {
|
||||
sourceDT.setDescription(refDT.getDescription());
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class DataTypeSynchronizer {
|
||||
if (!namesAreEquivalent(refDT, sourceDT)) {
|
||||
renameDataType(refDTM, refDT, sourceDT);
|
||||
}
|
||||
if (!StringUtils.equals(sourceDT.getDescription(), refDT.getDescription())) {
|
||||
if (!Strings.CS.equals(sourceDT.getDescription(), refDT.getDescription())) {
|
||||
refDT.setDescription(sourceDT.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -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.
|
||||
@@ -17,7 +17,7 @@ package ghidra.app.plugin.core.datamgr.editor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
|
||||
import docking.widgets.table.AbstractSortedTableModel;
|
||||
import docking.widgets.table.TableSortState;
|
||||
@@ -355,7 +355,7 @@ class EnumTableModel extends AbstractSortedTableModel<EnumEntry> {
|
||||
private class EnumCommentComparator implements Comparator<EnumEntry> {
|
||||
@Override
|
||||
public int compare(EnumEntry entry1, EnumEntry entry2) {
|
||||
return StringUtils.compare(entry1.getComment(), entry2.getComment());
|
||||
return Strings.CS.compare(entry1.getComment(), entry2.getComment());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -234,7 +234,7 @@ class DataWindowFilterDialog extends DialogComponentProvider {
|
||||
Set<Entry<String, Boolean>> entrySet = typeEnabledMap.entrySet();
|
||||
for (Entry<String, Boolean> entry : entrySet) {
|
||||
String checkboxName = entry.getKey();
|
||||
if (StringUtils.containsIgnoreCase(checkboxName, filterText)) {
|
||||
if (Strings.CI.contains(checkboxName, filterText)) {
|
||||
checkboxNameList.add(checkboxName);
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class DataWindowFilterDialog extends DialogComponentProvider {
|
||||
plugin.setFilterEnabled(false);
|
||||
}
|
||||
else {
|
||||
Coverage coverage = (Coverage) coverageCombo.getSelectedItem();
|
||||
Coverage coverage = coverageCombo.getSelectedItem();
|
||||
plugin.setFilter(typeEnabledMap, coverage);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ public class CallFixupAnalyzer extends AbstractAnalyzer {
|
||||
|
||||
private void addInThunkedFunctionsToList(Program program, AddressSetView initialSet,
|
||||
Function function, AddressSet functionAddresses) {
|
||||
Address[] thunkAddrs = function.getFunctionThunkAddresses();
|
||||
Address[] thunkAddrs = function.getFunctionThunkAddresses(false);
|
||||
if (thunkAddrs != null) {
|
||||
for (Address addr : thunkAddrs) {
|
||||
if (!initialSet.contains(addr)) {
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ public class EntryPointAnalyzer extends AbstractAnalyzer {
|
||||
}
|
||||
if (!foundNonJumpRef) {
|
||||
// check if we have been thunked
|
||||
Address[] functionThunkAddresses = function.getFunctionThunkAddresses();
|
||||
Address[] functionThunkAddresses = function.getFunctionThunkAddresses(false);
|
||||
foundNonJumpRef =
|
||||
functionThunkAddresses != null && functionThunkAddresses.length != 0;
|
||||
}
|
||||
|
||||
+4
-4
@@ -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.
|
||||
@@ -124,7 +124,7 @@ public class ProgramTreeModularizationPlugin extends ProgramPlugin {
|
||||
|
||||
DominanceModularizationCmd cmd =
|
||||
new DominanceModularizationCmd(node.getGroupPath(), node.getGroup().getTreeName(),
|
||||
currentSelection, blockModelService.getActiveSubroutineModel());
|
||||
currentSelection, blockModelService.getActiveSubroutineModel(currentProgram));
|
||||
tool.executeBackgroundCommand(cmd, currentProgram);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class ProgramTreeModularizationPlugin extends ProgramPlugin {
|
||||
ComplexityDepthModularizationCmd cmd =
|
||||
new ComplexityDepthModularizationCmd(node.getGroupPath(),
|
||||
node.getGroup().getTreeName(), currentSelection,
|
||||
blockModelService.getActiveSubroutineModel());
|
||||
blockModelService.getActiveSubroutineModel(currentProgram));
|
||||
tool.executeBackgroundCommand(cmd, currentProgram);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -136,12 +136,12 @@ public class FunctionReachabilityTableModel
|
||||
CodeBlockModel model;
|
||||
try {
|
||||
model = blockModelService.getNewModelByName(
|
||||
BlockModelService.ISOLATED_ENTRY_SUBROUTINE_MODEL_NAME);
|
||||
BlockModelService.ISOLATED_ENTRY_SUBROUTINE_MODEL_NAME, program);
|
||||
}
|
||||
catch (NotFoundException e) {
|
||||
Msg.error(this, "Code block model not found: " +
|
||||
BlockModelService.ISOLATED_ENTRY_SUBROUTINE_MODEL_NAME);
|
||||
model = blockModelService.getActiveSubroutineModel();
|
||||
model = blockModelService.getActiveSubroutineModel(program);
|
||||
}
|
||||
|
||||
return model.getCodeBlocks(monitor);
|
||||
@@ -179,7 +179,7 @@ public class FunctionReachabilityTableModel
|
||||
|
||||
Address targetAddress = destination.getDestinationAddress();
|
||||
BlockModelService blockModelService = serviceProvider.getService(BlockModelService.class);
|
||||
CodeBlockModel codeBlockModel = blockModelService.getActiveSubroutineModel();
|
||||
CodeBlockModel codeBlockModel = blockModelService.getActiveSubroutineModel(program);
|
||||
CodeBlock targetBlock = codeBlockModel.getFirstCodeBlockContaining(targetAddress, monitor);
|
||||
if (targetBlock == null) {
|
||||
return null; // no code found for call; external?
|
||||
|
||||
+4
-4
@@ -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.
|
||||
@@ -69,7 +69,7 @@ public class ResourceActionsPlugin extends Plugin {
|
||||
|
||||
new ActionBuilder("Save Image New Format", getName())
|
||||
.withContext(ProgramLocationActionContext.class)
|
||||
.validContextWhen(plac -> plac.getLocation() instanceof ResourceFieldLocation &&
|
||||
.validWhen(plac -> plac.getLocation() instanceof ResourceFieldLocation &&
|
||||
((ResourceFieldLocation) plac.getLocation()).isDataImageResource())
|
||||
.onAction(
|
||||
plac -> saveImageAsNewImage((ResourceFieldLocation) plac.getLocation()))
|
||||
@@ -78,7 +78,7 @@ public class ResourceActionsPlugin extends Plugin {
|
||||
|
||||
new ActionBuilder("Save Image Original Bytes", getName())
|
||||
.withContext(ProgramLocationActionContext.class)
|
||||
.validContextWhen(plac -> plac.getLocation() instanceof ResourceFieldLocation &&
|
||||
.validWhen(plac -> plac.getLocation() instanceof ResourceFieldLocation &&
|
||||
((ResourceFieldLocation) plac.getLocation()).isDataImageResource())
|
||||
.onAction(
|
||||
plac -> saveImageOriginalBytes((ResourceFieldLocation) plac.getLocation()))
|
||||
|
||||
+6
-5
@@ -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,8 @@ import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.InvalidInputException;
|
||||
import ghidra.util.task.*;
|
||||
import ghidra.util.task.Task;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
/**
|
||||
* The SelectByFlowPlugin adds selection of code based on program flow to a
|
||||
@@ -347,7 +348,7 @@ public class SelectByFlowPlugin extends Plugin implements OptionsChangeListener
|
||||
|
||||
monitor.initialize(startAddresses.getNumAddresses());
|
||||
|
||||
CodeBlockModel cbm = blockModelService.getActiveSubroutineModel();
|
||||
CodeBlockModel cbm = blockModelService.getActiveSubroutineModel(program);
|
||||
CodeBlockIterator iter = cbm.getCodeBlocksContaining(startAddresses, monitor);
|
||||
while (iter.hasNext()) {
|
||||
if (monitor.isCancelled()) {
|
||||
@@ -382,7 +383,7 @@ public class SelectByFlowPlugin extends Plugin implements OptionsChangeListener
|
||||
monitor.initialize(startAddresses.getNumAddresses());
|
||||
|
||||
ReferenceManager rm = program.getReferenceManager();
|
||||
CodeBlockModel cbm = blockModelService.getActiveSubroutineModel();
|
||||
CodeBlockModel cbm = blockModelService.getActiveSubroutineModel(program);
|
||||
CodeBlockIterator cbIter = cbm.getCodeBlocksContaining(startAddresses, monitor);
|
||||
|
||||
while (cbIter.hasNext()) {
|
||||
|
||||
+3
-4
@@ -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.
|
||||
@@ -238,8 +238,7 @@ public class SelectByScopedFlowPlugin extends ProgramPlugin {
|
||||
private ProgramSelection makeSelectionFromCodeBlocks(Collection<CodeBlock> blocks,
|
||||
Program program) {
|
||||
AddressSet set = getAddressForCodeBlocks(blocks, program);
|
||||
AddressFactory addressFactory = program.getAddressFactory();
|
||||
ProgramSelection selection = new ProgramSelection(addressFactory, set);
|
||||
ProgramSelection selection = new ProgramSelection(set);
|
||||
return selection;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1131,7 +1131,7 @@ class StackFrameDataType implements Structure {
|
||||
|
||||
wrappedStruct.delete(ordinal);
|
||||
|
||||
Range<Integer> r = Range.between(stackOffset, stackOffset + len - 1);
|
||||
Range<Integer> r = Range.of(stackOffset, stackOffset + len - 1);
|
||||
if (r.contains(parameterOffset)) {
|
||||
int negLenReduction = parameterOffset - stackOffset;
|
||||
negativeLength -= negLenReduction;
|
||||
|
||||
@@ -131,7 +131,7 @@ public interface BlockModelService {
|
||||
/**
|
||||
* Get new instance of the active Subroutine Block model for the current program.
|
||||
* @return new Subroutine Block model instance or null if program is not open
|
||||
* @deprecated use getActiveSubroutineModel(Program) instead
|
||||
* @deprecated use {@link #getActiveSubroutineModel(Program)} instead
|
||||
*/
|
||||
@Deprecated(since = "9.0")
|
||||
public CodeBlockModel getActiveSubroutineModel();
|
||||
@@ -140,7 +140,7 @@ public interface BlockModelService {
|
||||
* Get new instance of the active Subroutine Block model for the current program.
|
||||
* @param includeExternals externals are included if true
|
||||
* @return new Subroutine Block model instance or null if program is not open
|
||||
* @deprecated use getActiveSubroutineModel(Program) instead
|
||||
* @deprecated use {@link #getActiveSubroutineModel(Program, boolean)} instead
|
||||
*/
|
||||
@Deprecated(since = "9.0")
|
||||
public CodeBlockModel getActiveSubroutineModel(boolean includeExternals);
|
||||
@@ -171,7 +171,7 @@ public interface BlockModelService {
|
||||
* @param modelName name of registered block model
|
||||
* @return new model instance or null if program is not open.
|
||||
* @throws NotFoundException if specified model is not registered
|
||||
* @deprecated use getNewModelByName(String, Program) instead
|
||||
* @deprecated use {@link #getNewModelByName(String, Program)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public CodeBlockModel getNewModelByName(String modelName)
|
||||
@@ -183,7 +183,7 @@ public interface BlockModelService {
|
||||
* @param includeExternals externals are included if true
|
||||
* @return new model instance or null if program is not open.
|
||||
* @throws NotFoundException if specified model is not registered
|
||||
* @deprecated use getNewModelByName(String, Program, boolean) instead
|
||||
* @deprecated use {@link #getNewModelByName(String, Program, boolean)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public CodeBlockModel getNewModelByName(String modelName, boolean includeExternals)
|
||||
|
||||
@@ -15,37 +15,32 @@
|
||||
*/
|
||||
package ghidra.app.util;
|
||||
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.program.model.listing.CommentType;
|
||||
|
||||
/**
|
||||
* Class with a convenience method to get an array of the CodeUnit
|
||||
* comment types. The method is useful to loop through the comment types
|
||||
* once you have a code unit.
|
||||
*
|
||||
* @deprecated the {@link CommentType enum should be used in place of integers}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "11.4")
|
||||
public class CommentTypes {
|
||||
|
||||
private static int[] COMMENT_TYPES;
|
||||
private static int NUMBER_OF_COMMENT_TYPES = 5;
|
||||
|
||||
@Deprecated(forRemoval = true, since = "11.4")
|
||||
CommentTypes() {
|
||||
}
|
||||
|
||||
static {
|
||||
COMMENT_TYPES = new int[NUMBER_OF_COMMENT_TYPES];
|
||||
COMMENT_TYPES[0] = CodeUnit.PRE_COMMENT;
|
||||
COMMENT_TYPES[1] = CodeUnit.POST_COMMENT;
|
||||
COMMENT_TYPES[2] = CodeUnit.EOL_COMMENT;
|
||||
COMMENT_TYPES[3] = CodeUnit.PLATE_COMMENT;
|
||||
COMMENT_TYPES[4] = CodeUnit.REPEATABLE_COMMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return an array containing the comment types on a code unit}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "11.4")
|
||||
public static int[] getTypes() {
|
||||
return COMMENT_TYPES;
|
||||
CommentType[] types = CommentType.values();
|
||||
int[] ret = new int[types.length];
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
ret[i] = types[i].ordinal();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -118,7 +118,7 @@ public class XReferenceUtil {
|
||||
// Check for thunk reference
|
||||
Function func = prog.getFunctionManager().getFunctionAt(cu.getMinAddress());
|
||||
if (func != null) {
|
||||
Address[] thunkAddrs = func.getFunctionThunkAddresses();
|
||||
Address[] thunkAddrs = func.getFunctionThunkAddresses(false);
|
||||
if (thunkAddrs != null) {
|
||||
for (Address thunkAddr : thunkAddrs) {
|
||||
xrefList.add(new ThunkReference(thunkAddr, func.getEntryPoint()));
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ public class JsonPatch {
|
||||
|
||||
private static PatchLine lineFromJson(JsonObject jsonObj) throws IOException {
|
||||
PatchOp op = jsonObj.get("op") instanceof JsonPrimitive prim
|
||||
? PatchOp.fromChar(prim.getAsCharacter())
|
||||
? PatchOp.fromChar(prim.getAsString().charAt(0))
|
||||
: null;
|
||||
JsonElement value = jsonObj.get("value");
|
||||
if (op == null || op == PatchOp.ADD && value == null) {
|
||||
|
||||
@@ -331,7 +331,7 @@ class MarkupXmlMgr {
|
||||
// FIXME What do we need to do for externals in XML now?
|
||||
// FIXME
|
||||
SetExternalRefCmd addCmd = new SetExternalRefCmd(addr, opIndex, programName, label,
|
||||
libAddr, userDefined ? SourceType.USER_DEFINED : SourceType.IMPORTED);
|
||||
libAddr, RefType.DATA, userDefined ? SourceType.USER_DEFINED : SourceType.IMPORTED);
|
||||
addCmd.applyTo(program);
|
||||
|
||||
// // if there happens to be a pointer here, then
|
||||
|
||||
@@ -247,7 +247,7 @@ class SymbolTableXmlMgr {
|
||||
if (!f.isThunk()) {
|
||||
String thunkedName = name.substring(6);
|
||||
Symbol symbol = SymbolUtilities.getExpectedLabelOrFunctionSymbol(program,
|
||||
thunkedName, err -> log.error(null, err));
|
||||
thunkedName, err -> log.appendMsg(err));
|
||||
if (symbol == null || symbol.getSymbolType() != SymbolType.FUNCTION) {
|
||||
log.appendMsg(
|
||||
"Failed to establish thunk function for function at: " + addr);
|
||||
|
||||
@@ -94,9 +94,9 @@ public class DiffUtility extends SimpleDiffUtility {
|
||||
if (otherSpace == null) {
|
||||
return null;
|
||||
}
|
||||
Range<Long> r = Range.between(range.getMinAddress().getOffset(),
|
||||
Range<Long> r = Range.of(range.getMinAddress().getOffset(),
|
||||
range.getMaxAddress().getOffset(), unsignedLongComparator);
|
||||
Range<Long> otherSpaceRange = Range.between(otherSpace.getMinAddress().getOffset(),
|
||||
Range<Long> otherSpaceRange = Range.of(otherSpace.getMinAddress().getOffset(),
|
||||
otherSpace.getMaxAddress().getOffset(), unsignedLongComparator);
|
||||
if (!r.isOverlappedBy(otherSpaceRange)) {
|
||||
return null;
|
||||
|
||||
+3
-2
@@ -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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package docking.widgets.dialogs;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.clipboard;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.IsInstanceOf.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
+3
-2
@@ -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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.data;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.StringContains.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
+1
@@ -16,6 +16,7 @@
|
||||
package ghidra.app.plugin.core.functionwindow;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+3
-2
@@ -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.
|
||||
@@ -18,6 +18,7 @@ package ghidra.app.plugin.core.navigation.locationreferences;
|
||||
import static ghidra.GhidraOptions.*;
|
||||
import static ghidra.app.util.viewer.format.FormatManager.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
+3
-2
@@ -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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package ghidra.app.plugin.core.string;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
+3
-2
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package ghidra.framework.plugintool.dialog;
|
||||
|
||||
import static org.hamcrest.collection.IsEmptyCollection.empty;
|
||||
import static org.hamcrest.core.IsNot.not;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.collection.IsEmptyCollection.*;
|
||||
import static org.hamcrest.core.IsNot.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -46,11 +46,6 @@ public class MyTestMemory extends AddressSet implements Memory {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressSetView getInitializedAddressSet() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressSetView getAllInitializedAddressSet() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ public class AbstractSearchAndReplaceTest extends AbstractGhidraHeadedIntegratio
|
||||
}
|
||||
|
||||
protected void createComment(long address, CommentType commentType, String comment) {
|
||||
builder.createComment(Long.toHexString(address), comment, commentType.ordinal());
|
||||
builder.createComment(Long.toHexString(address), comment, commentType);
|
||||
}
|
||||
|
||||
protected void setSearchTypes(SearchType... searchTypes) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user