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

Add new interface for adjust rz reg contents in some cases #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Heersin
Copy link
Member

@Heersin Heersin commented Jun 29, 2023

BAP-qemu frame represent register D17 as two S registers(S34, S35), while those S registers(S32/S33 ...) are not existed in rz_reg for arm32.
dn register can be represented as concat(S_2n, S_2n+1), to get the correct d register value I need both two S register value in the for-loop of rz-tracetet
Currently my solution is to modify Adapter interface to support it. It will affect other architecture's adapters, I am not sure it's a best practice.

std::string r = tracereg;
std::transform(r.begin(), r.end(), r.begin(), ::tolower);

if (r.at(0) == 's') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to put the the comment from the PR description here, right in the code, otherwise it would be hard to understand why it's needed

@@ -192,7 +193,8 @@ FrameCheckResult RizinEmulator::RunFrame(ut64 index, frame *f, std::optional<ut6
continue;
}
RzBitVector *bv = rz_bv_new_from_bytes_le((const ut8 *)o.value().data(), 0, RegOperandSizeBits(o));
adapter->AdjustRegContentsFromTrace(ro.name(), bv);
RzBitVector *extra = rz_reg_get_bv(reg.get(), ri);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is a good idea to read register contents here. They might be undefined depending on what happened before.

@XVilka
Copy link
Member

XVilka commented Jul 11, 2024

What is the resolution with this? One year has passed.

@Rot127
Copy link
Member

Rot127 commented Jul 11, 2024

@Heersin Is it still needed? If not I would vote for closing so less changes.

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

Successfully merging this pull request may close these issues.

4 participants