mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
parent
443e398bb4
commit
8f1dc3f476
14 changed files with 386 additions and 319 deletions
|
@ -21,8 +21,7 @@
|
|||
//@category Examples.Demangler
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.app.util.demangler.DemangledObject;
|
||||
import ghidra.app.util.demangler.gnu.GnuDemangler;
|
||||
import ghidra.app.util.demangler.gnu.GnuDemanglerOptions;
|
||||
import ghidra.app.util.demangler.gnu.*;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
|
||||
public class DemangleElfWithOptionScript extends GhidraScript {
|
||||
|
@ -33,8 +32,8 @@ public class DemangleElfWithOptionScript extends GhidraScript {
|
|||
GnuDemangler demangler = new GnuDemangler();
|
||||
if (!demangler.canDemangle(currentProgram)) {
|
||||
String executableFormat = currentProgram.getExecutableFormat();
|
||||
println("Cannot use the elf demangling options for executable format: " +
|
||||
executableFormat);
|
||||
println(
|
||||
"Cannot use the elf demangling options for executable format: " + executableFormat);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -49,14 +48,12 @@ public class DemangleElfWithOptionScript extends GhidraScript {
|
|||
|
||||
String mangled = symbol.getName();
|
||||
|
||||
GnuDemanglerOptions options = new GnuDemanglerOptions();
|
||||
GnuDemanglerOptions options = new GnuDemanglerOptions(GnuDemanglerFormat.AUTO, false);
|
||||
options.setDoDisassembly(false);
|
||||
options.setDemanglerApplicationArguments("-s auto");
|
||||
|
||||
/*
|
||||
// for older formats use the deprecated demangler
|
||||
options.setDemanglerName(GnuDemanglerOptions.GNU_DEMANGLER_V2_24);
|
||||
options.setDemanglerApplicationArguments("-s arm");
|
||||
options = options.withDemanglerFormat(GnuDemanglerFormat.ARM, true);
|
||||
*/
|
||||
|
||||
DemangledObject demangledObject = demangler.demangle(mangled, options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue