mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-1658 - Updated success/failure status of the DemanglerCmd
This commit is contained in:
parent
56a8346e78
commit
22b0d2dfa5
2 changed files with 8 additions and 6 deletions
|
@ -18,6 +18,7 @@
|
|||
//Works for both Microsoft and Gnu mangled symbols
|
||||
//@category Symbol
|
||||
|
||||
import docking.*;
|
||||
import ghidra.app.cmd.label.DemanglerCmd;
|
||||
import ghidra.app.context.ProgramSymbolActionContext;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
|
@ -26,7 +27,6 @@ import ghidra.program.model.listing.Data;
|
|||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
import ghidra.program.util.*;
|
||||
import docking.*;
|
||||
|
||||
public class DemangleSymbolScript extends GhidraScript {
|
||||
|
||||
|
@ -101,10 +101,10 @@ public class DemangleSymbolScript extends GhidraScript {
|
|||
DemanglerCmd cmd = new DemanglerCmd(address, name);
|
||||
boolean success = cmd.applyTo(currentProgram, monitor);
|
||||
if (success) {
|
||||
println("Successfully demangled!\n" + name + '\n' + cmd.getResult());
|
||||
println("Successfully demangled\n" + name + '\n' + cmd.getResult());
|
||||
}
|
||||
else {
|
||||
println(cmd.getStatusMsg());
|
||||
println("Failed to demangle\n" + name + '\n' + cmd.getStatusMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,9 @@ public class DemanglerCmd extends BackgroundCommand {
|
|||
|
||||
@Override
|
||||
public boolean applyTo(DomainObject obj, TaskMonitor monitor) {
|
||||
Program prog = (Program) obj;
|
||||
|
||||
// search until we find a demangler that can handle the given mangled input
|
||||
Program prog = (Program) obj;
|
||||
for (Demangler demangler : getDemanglers()) {
|
||||
if (!demangler.canDemangle(prog)) {
|
||||
continue;
|
||||
|
@ -62,11 +63,11 @@ public class DemanglerCmd extends BackgroundCommand {
|
|||
}
|
||||
|
||||
if (result != null) {
|
||||
break; // successful; don't try a different demangler
|
||||
return true; // successful; don't try a different demangler
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean doDemangle(Demangler demangler, Program program, TaskMonitor monitor) {
|
||||
|
@ -77,6 +78,7 @@ public class DemanglerCmd extends BackgroundCommand {
|
|||
catch (DemangledException e) {
|
||||
if (e.isInvalidMangledName()) {
|
||||
//ignore invalid names, consider as not an error
|
||||
setStatusMsg("Invalid mangled name");
|
||||
return true; // no real error
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue