GP-4898 - All Demanglers: added MangledContext; Microsoft MDMang: added

C-style mangling scheme and moved Demangler type hierarchies out of
MDMang
This commit is contained in:
ghizard 2024-09-18 08:50:28 -04:00
parent 3670d91d80
commit 737ea4d31f
53 changed files with 3016 additions and 1460 deletions

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -19,6 +19,7 @@
//@category Demangler
import ghidra.app.script.GhidraScript;
import ghidra.app.util.demangler.DemangledObject;
import ghidra.app.util.demangler.MangledContext;
import ghidra.app.util.demangler.swift.*;
import ghidra.app.util.demangler.swift.SwiftNativeDemangler.SwiftNativeDemangledOutput;
import ghidra.program.model.symbol.*;
@ -53,12 +54,14 @@ public class SwiftDemanglerScript extends GhidraScript {
println("No mangled Swift symbols found at " + currentAddress);
return;
}
SwiftNativeDemangler nativeDemangler = new SwiftNativeDemangler(options.getSwiftDir());
SwiftNativeDemangledOutput demangledOutput = nativeDemangler.demangle(mangled);
println(demangledOutput.toString());
DemangledObject demangledObject = demangler.demangle(mangled);
MangledContext mangledContext =
demangler.createMangledContext(mangled, options, currentProgram, currentAddress);
DemangledObject demangledObject = demangler.demangle(mangledContext);
if (demangledObject != null) {
println(demangledObject.getClass().getSimpleName() + " " + mangled + " --> " +
demangledObject);