GT-3414, issue #1259 - fix GUI lockup when defined strings table loads

A large binary with lots of strings can cause the "Defined Strings"
table to fight with the Listing view over database locks.

This change eases some of the issues by making the defined strings table
be nicer by yielding to the swing thread before starting its query loop
(which allows a Listing view which is also doing its full rendering at
the same time to finish before the loop starts) and making the
DefinedDataIterator a bit smarter about what elements it needs to
recurse into.

The Listing can still be quite a bit laggy when the Defined Strings
table is loading.

Also fixed a logic error in StringDataInstance that caused it to return
a empty string for arrays of character elements.
This commit is contained in:
dev747368
2019-12-20 11:46:25 -05:00
parent 4d29a3820d
commit 4fbbe989be
6 changed files with 172 additions and 67 deletions
@@ -21,6 +21,7 @@ import ghidra.program.model.data.StringDataInstance;
import ghidra.program.model.data.TranslationSettingsDefinition;
import ghidra.program.model.listing.Data;
import ghidra.program.util.DefinedDataIterator;
import util.CollectionUtils;
public class TranslateStringsScript extends GhidraScript {
@@ -39,7 +40,8 @@ public class TranslateStringsScript extends GhidraScript {
int count = 0;
monitor.initialize(currentProgram.getListing().getNumDefinedData());
monitor.setMessage("Translating strings");
for (Data data : DefinedDataIterator.definedStrings(currentProgram, currentSelection)) {
for (Data data : CollectionUtils.asIterable(
DefinedDataIterator.definedStrings(currentProgram, currentSelection))) {
if (monitor.isCancelled()) {
break;
}