Skip to content

Commit

Permalink
GP-3868 rtti script - added code to skip external function editing
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidra007 committed Sep 22, 2023
1 parent 5c8251f commit 81ad8d3
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3466,6 +3466,11 @@ public void addConstructorsToClassNamespace(RecoveredClass recoveredClass,
monitor.checkCancelled();
Function constructorFunction = constructorsIterator.next();

// cannot edit external functions
if (constructorFunction.isExternal()) {
continue;
}

if (nameVfunctions) {
createNewSymbolAtFunction(constructorFunction, className, classNamespace, true,
true);
Expand Down Expand Up @@ -3552,6 +3557,11 @@ public void addDestructorsToClassNamespace(RecoveredClass recoveredClass, Struct
while (destructorIterator.hasNext()) {
monitor.checkCancelled();
Function destructorFunction = destructorIterator.next();

// cannot edit external functions
if (destructorFunction.isExternal()) {
continue;
}
String destructorName = "~" + className;

if (nameVfunctions) {
Expand Down Expand Up @@ -3579,6 +3589,11 @@ public void addNonThisDestructorsToClassNamespace(RecoveredClass recoveredClass)
while (destructorIterator.hasNext()) {
monitor.checkCancelled();
Function destructorFunction = destructorIterator.next();

// cannot edit external functions
if (destructorFunction.isExternal()) {
continue;
}
String destructorName = "~" + className;

createNewSymbolAtFunction(destructorFunction, destructorName, classNamespace, false,
Expand All @@ -3598,7 +3613,9 @@ public void addVbaseDestructorsToClassNamespace(RecoveredClass recoveredClass,
Namespace classNamespace = recoveredClass.getClassNamespace();

Function vbaseDestructorFunction = recoveredClass.getVBaseDestructor();
if (vbaseDestructorFunction != null) {

// only edit non-external functions
if (vbaseDestructorFunction != null && !vbaseDestructorFunction.isExternal()) {
String destructorName = VBASE_DESTRUCTOR_LABEL;

if (nameVfunctions) {
Expand Down Expand Up @@ -3730,6 +3747,10 @@ private void createNewSymbolAtFunction(Function function, String name, Namespace
boolean setPrimary, boolean removeBadFID) throws DuplicateNameException,
InvalidInputException, CircularDependencyException, CancelledException {

// skip if external function
if (function.isExternal()) {
return;
}
// check for bad FID or FID that needs fix up and remove those bad symbols
if (removeBadFID) {
removeBadFIDSymbols(namespace, name, function);
Expand Down Expand Up @@ -5196,6 +5217,11 @@ public void createIndeterminateLabels(RecoveredClass recoveredClass, Structure c
monitor.checkCancelled();
Function indeterminateFunction = unknownsIterator.next();

// cannot edit external functions
if (indeterminateFunction.isExternal()) {
continue;
}

if (nameVfunctions) {
createNewSymbolAtFunction(indeterminateFunction,
className + "_Constructor_or_Destructor", classNamespace, false, false);
Expand Down

0 comments on commit 81ad8d3

Please sign in to comment.