GP-94 - Gnu Demangler - review fixes

Closes #2214
This commit is contained in:
dragonmacher 2021-02-12 16:05:26 -05:00
parent 443e398bb4
commit 8f1dc3f476
14 changed files with 386 additions and 319 deletions

View file

@ -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);