Ghidra is a software reverse engineering (SRE) framework
GP-4862 fixed gcc dupe namespace creation mechanism.
ghidra00707d2c34b3fe4
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.javaindex 092f8a32a1..3f5b6ce71f 100644--- a/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.java+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.java@@ -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.@@ -2820,20 +2820,24 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {// get the newly created symbol to get the namespaceSymbol typeinfoNameSymbol = symbolTable.getPrimarySymbol(typeinfoNameAddress);+ Namespace typeinfoNamespace = typeinfoNameSymbol.getParentNamespace();+// need to account for rare case where there are more than one typeinfos with// exact same class and name so make two classes in this case - name second one// dupe#List<Symbol> symbols = symbolTable.getSymbols(typeinfoNameSymbol.getName(),- typeinfoNameSymbol.getParentNamespace());+ typeinfoNamespace);if (symbols.size() > 1) {+ Namespace parentNamespace = typeinfoNamespace.getParentNamespace();Msg.debug(this, "Duplicate typeinfo namespace: " +- typeinfoNameSymbol.getParentNamespace().toString());+ typeinfoNamespace.toString());for (Symbol symbol : symbols) {Msg.debug(this, symbol.getAddress());}- Namespace newNamespace = symbolTable.getOrCreateNameSpace(globalNamespace,- typeinfoNameSymbol.getParentNamespace().getName(true) + "DUPE",++ Namespace newNamespace = symbolTable.getOrCreateNameSpace(parentNamespace,+ typeinfoNamespace.getName() + "DUPE",SourceType.ANALYSIS);try {typeinfoNameSymbol.setNamespace(newNamespace);@@ -2868,7 +2872,6 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {return newSymbol;}-private Symbol createTypeinfoSymbolFromNonMangledString(Address typeinfoAddress)throws DuplicateNameException, InvalidInputException, CancelledException {@@ -3753,7 +3756,6 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {return null;}-/** Method to find special vtable using special typeinfo references. This* assumption that vtable is defaultPtrSize above ref to single specialTypeinfo