GP-4862 fixed gcc dupe namespace creation mechanism.

This commit is contained in:
ghidra007 2024-08-21 16:57:21 +00:00
parent e887248460
commit 07d2c34b3f

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.
@ -2820,20 +2820,24 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
// get the newly created symbol to get the namespace
Symbol 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