mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-20 23:08:31 +08:00
Merge remote-tracking branch
'origin/GP-3236_ghidra1_PeMingwRelocs--SQUASHED' (Closes #5155)
This commit is contained in:
+705
File diff suppressed because it is too large
Load Diff
+1
@@ -103,6 +103,7 @@ public class RelocationTablePlugin extends Plugin implements DomainObjectListene
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(ChangeManager.DOCR_IMAGE_BASE_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_RELOCATION_ADDED) ||
|
||||
ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
provider.setProgram(currentProgram);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class FlatProgramAPI {
|
||||
* only necessary to analyze changes and not the entire program which can take much
|
||||
* longer and affect more of the program than is necessary.
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public void analyze(Program program) {
|
||||
analyzeAll(program);
|
||||
}
|
||||
@@ -405,7 +405,7 @@ public class FlatProgramAPI {
|
||||
* @deprecated use {@link #createLabel(Address, String, boolean)} instead.
|
||||
* Deprecated in Ghidra 7.4
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public final Symbol createSymbol(Address address, String name, boolean makePrimary)
|
||||
throws Exception {
|
||||
return createLabel(address, name, makePrimary);
|
||||
@@ -443,9 +443,8 @@ public class FlatProgramAPI {
|
||||
*/
|
||||
public final Symbol createLabel(Address address, String name, Namespace namespace,
|
||||
boolean makePrimary, SourceType sourceType) throws Exception {
|
||||
Symbol symbol;
|
||||
SymbolTable symbolTable = currentProgram.getSymbolTable();
|
||||
symbol = symbolTable.createLabel(address, name, namespace, sourceType);
|
||||
Symbol symbol = symbolTable.createLabel(address, name, namespace, sourceType);
|
||||
if (makePrimary && !symbol.isPrimary()) {
|
||||
SetLabelPrimaryCmd cmd = new SetLabelPrimaryCmd(address, name, namespace);
|
||||
if (cmd.applyTo(currentProgram)) {
|
||||
@@ -458,7 +457,7 @@ public class FlatProgramAPI {
|
||||
/**
|
||||
* @deprecated use {@link #createLabel(Address, String, boolean, SourceType)} instead. Deprecated in Ghidra 7.4
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public final Symbol createSymbol(Address address, String name, boolean makePrimary,
|
||||
boolean makeUnique, SourceType sourceType) throws Exception {
|
||||
return createLabel(address, name, makePrimary, sourceType);
|
||||
@@ -1129,7 +1128,7 @@ public class FlatProgramAPI {
|
||||
* no longer have to be unique. Use {@link #getGlobalFunctions(String)}
|
||||
* Deprecated in Ghidra 7.4
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public final Function getFunction(String name) {
|
||||
List<Function> globalFunctions = currentProgram.getListing().getGlobalFunctions(name);
|
||||
return globalFunctions.isEmpty() ? null : globalFunctions.get(0);
|
||||
@@ -1383,7 +1382,7 @@ public class FlatProgramAPI {
|
||||
* @deprecated Since the same label name can be at the same address if in a different namespace,
|
||||
* this method is ambiguous. Use {@link #getSymbolAt(Address, String, Namespace)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public final Symbol getSymbolAt(Address address, String name) {
|
||||
SymbolIterator symbols = currentProgram.getSymbolTable().getSymbolsAsIterator(address);
|
||||
for (Symbol symbol : symbols) {
|
||||
@@ -1477,7 +1476,7 @@ public class FlatProgramAPI {
|
||||
* @throws IllegalStateException if there is more than one symbol with that name.
|
||||
* @deprecated use {@link #getSymbols(String, Namespace)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public final Symbol getSymbol(String name, Namespace namespace) {
|
||||
List<Symbol> symbols = currentProgram.getSymbolTable().getSymbols(name, namespace);
|
||||
if (symbols.size() == 1) {
|
||||
@@ -1583,7 +1582,7 @@ public class FlatProgramAPI {
|
||||
* @deprecated This method is deprecated because it did not allow you to include the
|
||||
* largest possible address. Instead use the one that takes a start address and a length.
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public final ProgramFragment createFragment(String fragmentName, Address start, Address end)
|
||||
throws DuplicateNameException, NotFoundException {
|
||||
ProgramModule module = currentProgram.getListing().getDefaultRootModule();
|
||||
@@ -1617,7 +1616,7 @@ public class FlatProgramAPI {
|
||||
* @deprecated This method is deprecated because it did not allow you to include the
|
||||
* largest possible address. Instead use the one that takes a start address and a length.
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(since = "7.4", forRemoval = true)
|
||||
public final ProgramFragment createFragment(ProgramModule module, String fragmentName,
|
||||
Address start, Address end) throws DuplicateNameException, NotFoundException {
|
||||
ProgramFragment fragment = getFragment(module, fragmentName);
|
||||
|
||||
+2
-6
@@ -19,12 +19,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import generic.jar.ResourceFile;
|
||||
import ghidra.app.util.demangler.DemangledAddressTable;
|
||||
import ghidra.app.util.demangler.DemangledException;
|
||||
import ghidra.app.util.demangler.DemangledFunction;
|
||||
import ghidra.app.util.demangler.DemangledObject;
|
||||
import ghidra.app.util.demangler.Demangler;
|
||||
import ghidra.app.util.demangler.DemanglerOptions;
|
||||
import ghidra.app.util.demangler.*;
|
||||
import ghidra.app.util.opinion.ElfLoader;
|
||||
import ghidra.app.util.opinion.MachoLoader;
|
||||
import ghidra.framework.Application;
|
||||
@@ -66,6 +61,7 @@ public class GnuDemangler implements Demangler {
|
||||
if (!specId.toLowerCase().contains("windows")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+15
-2
@@ -31,6 +31,7 @@ import ghidra.program.model.mem.Memory;
|
||||
import ghidra.program.model.reloc.Relocation;
|
||||
import ghidra.program.model.reloc.Relocation.Status;
|
||||
import ghidra.program.model.reloc.RelocationTable;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.VersionException;
|
||||
@@ -147,9 +148,15 @@ public class RelocationManager implements RelocationTable, ManagerDB {
|
||||
try {
|
||||
byte flags = RelocationDBAdapter.getFlags(status, 0);
|
||||
adapter.add(addr, flags, type, values, bytes, symbolName);
|
||||
return new Relocation(addr, status, type, values,
|
||||
Relocation reloc = new Relocation(addr, status, type, values,
|
||||
getOriginalBytes(addr, status, bytes, 0),
|
||||
symbolName);
|
||||
|
||||
// fire event
|
||||
// TODO: full change support is missing
|
||||
program.setChanged(ChangeManager.DOCR_RELOCATION_ADDED, null, reloc);
|
||||
|
||||
return reloc;
|
||||
}
|
||||
catch (IOException e) {
|
||||
program.dbError(e);
|
||||
@@ -167,9 +174,15 @@ public class RelocationManager implements RelocationTable, ManagerDB {
|
||||
try {
|
||||
byte flags = RelocationDBAdapter.getFlags(status, byteLength);
|
||||
adapter.add(addr, flags, type, values, null, symbolName);
|
||||
return new Relocation(addr, status, type, values,
|
||||
Relocation reloc = new Relocation(addr, status, type, values,
|
||||
getOriginalBytes(addr, status, null, byteLength),
|
||||
symbolName);
|
||||
|
||||
// fire event
|
||||
// TODO: full change support is missing
|
||||
program.setChanged(ChangeManager.DOCR_RELOCATION_ADDED, null, reloc);
|
||||
|
||||
return reloc;
|
||||
}
|
||||
catch (IOException e) {
|
||||
program.dbError(e);
|
||||
|
||||
+9
@@ -179,16 +179,25 @@ public abstract class AbstractPointerTypedefBuiltIn extends BuiltIn implements T
|
||||
|
||||
@Override
|
||||
public Class<?> getValueClass(Settings settings) {
|
||||
if (settings == null) {
|
||||
settings = getDefaultSettings();
|
||||
}
|
||||
return modelTypedef.getValueClass(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(MemBuffer buf, Settings settings, int length) {
|
||||
if (settings == null) {
|
||||
settings = getDefaultSettings();
|
||||
}
|
||||
return modelTypedef.getValue(buf, settings, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRepresentation(MemBuffer buf, Settings settings, int length) {
|
||||
if (settings == null) {
|
||||
settings = getDefaultSettings();
|
||||
}
|
||||
return modelTypedef.getRepresentation(buf, settings, length);
|
||||
}
|
||||
|
||||
|
||||
+11
@@ -724,6 +724,17 @@ public interface ChangeManager {
|
||||
*/
|
||||
public static final int DOCR_USER_DATA_CHANGED = 201;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// RELOCATIONS
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A relocation entry was added
|
||||
*/
|
||||
public static final int DOCR_RELOCATION_ADDED = 210;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Mark the state of a Program as having changed and generate
|
||||
|
||||
Reference in New Issue
Block a user