Merge remote-tracking branch

'origin/GP-5682-dragonmacher-vxworks-headless-script-fix' into
Ghidra_11.4 (Closes #8156)
This commit is contained in:
Ryan Kurtz 2025-05-15 13:35:35 -04:00
commit 60ce1f523d

View file

@ -47,7 +47,6 @@ import ghidra.app.cmd.disassemble.DisassembleCommand;
import ghidra.app.cmd.label.DemanglerCmd; import ghidra.app.cmd.label.DemanglerCmd;
import ghidra.app.plugin.core.analysis.AutoAnalysisManager; import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
import ghidra.app.script.GhidraScript; import ghidra.app.script.GhidraScript;
import ghidra.app.services.DataTypeManagerService;
import ghidra.app.util.demangler.DemangledException; import ghidra.app.util.demangler.DemangledException;
import ghidra.app.util.demangler.MangledContext; import ghidra.app.util.demangler.MangledContext;
import ghidra.app.util.demangler.gnu.GnuDemangler; import ghidra.app.util.demangler.gnu.GnuDemangler;
@ -64,28 +63,6 @@ public class VxWorksSymTab_Finder extends GhidraScript {
boolean debug = false; boolean debug = false;
//------------------------------------------------------------------------
// getDataTypeManagerByName
//
// Retrieves data type manager by name.
//
// Returns:
// Success: DataTypeManager
// Failure: null
//------------------------------------------------------------------------
private DataTypeManager getDataTypeManagerByName(String name) {
DataTypeManagerService service = state.getTool().getService(DataTypeManagerService.class);
// Loop through all managers in the data type manager service
for (DataTypeManager manager : service.getDataTypeManagers()) {
if (manager.getName().equals(name)) {
return manager;
}
}
return null;
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// VxSymbol // VxSymbol
// //
@ -159,7 +136,7 @@ public class VxWorksSymTab_Finder extends GhidraScript {
private VxSymbol getVxSymbolClass(int type) { private VxSymbol getVxSymbolClass(int type) {
// Pre-define base data types used to define symbol table entry data type // Pre-define base data types used to define symbol table entry data type
DataTypeManager builtin = getDataTypeManagerByName("BuiltInTypes"); BuiltInDataTypeManager builtin = BuiltInDataTypeManager.getDataTypeManager();
DataType charType = builtin.getDataType("/char"); DataType charType = builtin.getDataType("/char");
DataType charPtrType = PointerDataType.getPointer(charType, 4); DataType charPtrType = PointerDataType.getPointer(charType, 4);
DataType byteType = builtin.getDataType("/byte"); DataType byteType = builtin.getDataType("/byte");
@ -417,7 +394,7 @@ public class VxWorksSymTab_Finder extends GhidraScript {
private boolean isSymTblEntry(Address entry, VxSymbol vxSymbol) throws Exception { private boolean isSymTblEntry(Address entry, VxSymbol vxSymbol) throws Exception {
// Make sure there's data for the symbol // Make sure there's data for the symbol
if ( !isAddress(entry.getOffset() + vxSymbol.length() - 1) ) { if (!isAddress(entry.getOffset() + vxSymbol.length() - 1)) {
return false; return false;
} }