Skip to content

Commit

Permalink
Make throw helper detection less zealous
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Byass committed Oct 20, 2021
1 parent 58926a5 commit 839dab1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static bool IsThrowHelper(long pointer, int depth = 0)
_checkedAddresses.Add(pointer);

//This will only return up to the first branch, because it's an unmanaged function, but that's fine for these purposes
var funcBody = Utils.GetArm64MethodBodyAtVirtualAddress((ulong)pointer, false);
var funcBody = Utils.GetArm64MethodBodyAtVirtualAddress((ulong)pointer, false, 14);

var registerPages = new Dictionary<string, long>();
foreach (var arm64Instruction in funcBody.Where(i => i.Mnemonic is "adrp" && i.Details.Operands[0].Type == Arm64OperandType.Register))
Expand Down
5 changes: 5 additions & 0 deletions Cpp2IL.Core/Analysis/AsmAnalyzerArmV8A.InstructionChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ private void CheckForSingleOpInstruction(Arm64Instruction instruction)
{
Analysis.Actions.Add(new Arm64NewObjectAction(Analysis, instruction));
}
else if (LibCpp2IlMain.Binary!.ConcreteGenericImplementationsByAddress.ContainsKey(jumpTarget))
{
//Call concrete generic function
Analysis.Actions.Add(new Arm64ManagedFunctionCallAction(Analysis, instruction));
}
else if (jumpTarget < Utils.GetAddressOfNextFunctionStart((ulong)instruction.Address) && jumpTarget > (ulong)instruction.Address)
{
//Jumping over an instruction, may need to expand function to include jumpTarget.
Expand Down

0 comments on commit 839dab1

Please sign in to comment.