Skip to content

Commit

Permalink
Update comment for relative branch immediates
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Dec 21, 2023
1 parent 45fb10a commit 7f2de98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion instructionAPI/src/x86/decoder.C
Expand Up @@ -200,7 +200,6 @@ namespace Dyninst { namespace InstructionAPI {
return;
}

// It looks like that Capstone automatically adjust the offset with the instruction length
auto IP(makeRegisterExpression(MachRegister::getPC(m_Arch)));

auto const& dis = dis_with_detail;
Expand All @@ -209,6 +208,8 @@ namespace Dyninst { namespace InstructionAPI {
auto const usesRelativeAddressing = cs_insn_group(dis.handle, dis.insn, CS_GRP_BRANCH_RELATIVE);

if(usesRelativeAddressing) {
// Capstone adjusts the offset to account for the current instruction's length, so we can
// just create an addition AST expression here.
auto target(makeAddExpression(IP, immAST, s64));
insn->addSuccessor(target, isCall, false, isConditional, false);
} else {
Expand Down

0 comments on commit 7f2de98

Please sign in to comment.