Merge remote-tracking branch

'origin/GP-3091_ghidra_ElfPowerPC64_ELFv1Fixes' (Closes #570)
This commit is contained in:
Ryan Kurtz 2025-07-25 19:07:17 +00:00
commit 4aaf18f435
7 changed files with 375 additions and 176 deletions

View file

@ -20,6 +20,8 @@ import static ghidra.program.util.FunctionChangeRecord.FunctionChangeType.*;
import java.io.IOException;
import java.util.*;
import javax.help.UnsupportedOperationException;
import db.DBRecord;
import ghidra.program.database.*;
import ghidra.program.database.data.DataTypeManagerDB;
@ -140,6 +142,9 @@ public class FunctionDB extends DatabaseObject implements Function {
@Override
public void setThunkedFunction(Function referencedFunction) {
if (isExternal()) {
throw new UnsupportedOperationException("External functions may not be a thunk");
}
if ((referencedFunction != null) && !(referencedFunction instanceof FunctionDB)) {
throw new IllegalArgumentException("FunctionDB expected for referenced function");
}

View file

@ -702,6 +702,7 @@ public interface Function extends Namespace {
* @throws IllegalArgumentException if an attempt is made to thunk a function or another
* thunk which would result in a loop back to this function or if this function is an external
* function, or specified function is from a different program instance.
* @throws UnsupportedOperationException if this method is invoked on an external function.
*/
public void setThunkedFunction(Function thunkedFunction) throws IllegalArgumentException;

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.
@ -113,6 +113,8 @@ public interface FunctionManager extends ManagerDB {
* @return new function or null if one or more functions overlap the specified body address set.
* @throws OverlappingFunctionException if the address set of the body overlaps an existing
* function
* @throws UnsupportedOperationException if this method is invoked on an external entryPoint
* address.
*/
public Function createThunkFunction(String name, Namespace nameSpace, Address entryPoint,
AddressSetView body, Function thunkedFunction, SourceType source)