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 tests for unwind_frame #34

Open
kammce opened this issue Jul 24, 2024 · 0 comments
Open

👷 Add tests for unwind_frame #34

kammce opened this issue Jul 24, 2024 · 0 comments
Labels
⚡️ enhancement New feature or request

Comments

@kammce
Copy link
Member

kammce commented Jul 24, 2024

unwind_frame should be reasonably easy to test with. You pass it a set of instructions and a cpu state and it should just work. You can create your own stack memory by creating an std::array<uint32_t, N>, filling it with the necessary information you'd see from a typical function call and assign the last position of the stack as the stack pointer. Then the CPU state can be checked against what the expected CPU state should be after the unwind has taken place.

Might even be helpful to have a class manage generating the stack memory. Something like this perhaps?

template <size_t Length>
class arm_abi_stack {

  void push(std::uint32_t lr, ...);
  // etc

  std::array<std::uint32_t, Length> stack{};
  std::uint32_t* stack_pointer = stack.data();
};
@kammce kammce added the ⚡️ enhancement New feature or request label Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡️ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant