Merge remote-tracking branch 'origin/GP-953-dragonmacher-demangler-thumb-mode-fix--SQUASHED' into Ghidra_10.0

This commit is contained in:
ghidra1 2021-06-07 18:02:09 -04:00
commit 328ce71521
2 changed files with 8 additions and 3 deletions

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.
@ -258,7 +258,6 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
*/
protected void apply(Program program, Address address, DemangledObject demangled,
DemanglerOptions options, MessageLog log, TaskMonitor monitor) {
try {
if (demangled.applyTo(program, address, options, monitor)) {
return;

View file

@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import ghidra.app.cmd.disassemble.DisassembleCommand;
import ghidra.app.cmd.function.*;
import ghidra.app.util.NamespaceUtils;
import ghidra.app.util.PseudoDisassembler;
import ghidra.program.database.data.DataTypeUtilities;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSetView;
@ -378,6 +379,11 @@ public class DemangledFunction extends DemangledObject {
public boolean applyTo(Program program, Address address, DemanglerOptions options,
TaskMonitor monitor) throws Exception {
// Account for register context. This class may trigger disassembly, so we need to make
// sure that the context is correctly set before that happens. Also, be sure to apply
// the function to the correct address.
address = PseudoDisassembler.setTargeContextForDisassembly(program, address);
if (!passesPreconditions(program, address)) {
return true; // eventually will not return anything
}