mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-29 07:35:54 +08:00
Merge remote-tracking branch 'origin/GP-6792_dev747368_dont_auto_expand_chararray_strings_when_navigating--SQUASHED'
This commit is contained in:
+13
-3
@@ -45,6 +45,7 @@ import ghidra.app.util.viewer.format.FieldHeader;
|
|||||||
import ghidra.app.util.viewer.format.FormatManager;
|
import ghidra.app.util.viewer.format.FormatManager;
|
||||||
import ghidra.app.util.viewer.util.*;
|
import ghidra.app.util.viewer.util.*;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
|
import ghidra.program.model.data.StringDataInstance;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.model.symbol.*;
|
import ghidra.program.model.symbol.*;
|
||||||
import ghidra.program.util.*;
|
import ghidra.program.util.*;
|
||||||
@@ -834,7 +835,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
|
|||||||
Program program = getProgram();
|
Program program = getProgram();
|
||||||
CodeUnit cu = program.getListing().getCodeUnitContaining(address);
|
CodeUnit cu = program.getListing().getCodeUnitContaining(address);
|
||||||
if (cu instanceof Data data) {
|
if (cu instanceof Data data) {
|
||||||
openData(data, address);
|
openDataAndShowComponentAtAddress(data, address);
|
||||||
}
|
}
|
||||||
else if (cu instanceof Instruction instruction) {
|
else if (cu instanceof Instruction instruction) {
|
||||||
openFunction(instruction);
|
openFunction(instruction);
|
||||||
@@ -859,7 +860,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openData(Data data, Address address) {
|
private void openDataAndShowComponentAtAddress(Data data, Address address) {
|
||||||
if (data.getComponent(0) == null) {
|
if (data.getComponent(0) == null) {
|
||||||
// not sub data to open
|
// not sub data to open
|
||||||
return;
|
return;
|
||||||
@@ -870,10 +871,19 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subData != data && subData.getParentOffset() == 0 &&
|
||||||
|
StringDataInstance.isString(subData.getParent())) {
|
||||||
|
// if the primitive subData was the first char inside a char[], manipulate subData
|
||||||
|
// so that we skip opening the char[], but retain any parents that contain it.
|
||||||
|
subData = subData.getParent().getParent();
|
||||||
|
if (subData == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (openAllData(subData)) {
|
if (openAllData(subData)) {
|
||||||
layoutModel.dataChanged(true);
|
layoutModel.dataChanged(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private FieldLocation getFieldLocationForDataAndOpenAsNeeded(Data data, Address address) {
|
private FieldLocation getFieldLocationForDataAndOpenAsNeeded(Data data, Address address) {
|
||||||
|
|||||||
Reference in New Issue
Block a user