Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to extract an expression from a block ? #76

Closed
idkreally785 opened this issue Jul 28, 2022 · 1 comment
Closed

How to extract an expression from a block ? #76

idkreally785 opened this issue Jul 28, 2022 · 1 comment

Comments

@idkreally785
Copy link

For example, I have this block, how do I correctly generate an expression for reg_ax

vtil::register_desc reg_ax(vtil::register_physical, registers::ax, vtil::arch::bit_count, 0);

auto block = vtil::basic_block::begin(0x1337);

block->mov(reg_ax, 0x10);
block->add(reg_ax, 0x1);
block->vexit(0ull);

I tried using the tracer like this, but to no avail. Regardless of whether I use tracer or not, I get the result "rax#0x1337", the same will happen without tracing if I just use variable.to_expression()

vtil::tracer tracer;
auto expression = tracer.rtrace_p({ block->begin(), reg_ax });

vtil::logger::log("%s\n", expression.to_string());
@idkreally785 idkreally785 changed the title How to extract expression from block ? How to extract an expression from block ? Jul 28, 2022
@idkreally785 idkreally785 changed the title How to extract an expression from block ? How to extract an expression from a block ? Jul 28, 2022
@can1357
Copy link
Member

can1357 commented Jul 28, 2022

The tracer takes a point of reference as to where to read the value at, since you specify block begin, this results in rax#1337, aka value at the beginning of the routine.

Give block->end() a try. Feel free to reopen if that does not solve it.

@can1357 can1357 closed this as completed Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants