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

Change default behavior when emulating in new trace to set the current context's stack pointer #6427

Open
sadeli413 opened this issue Apr 15, 2024 · 1 comment
Assignees
Labels
Feature: Emulation Status: Triage Information is being gathered

Comments

@sadeli413
Copy link

Current behavior
When setting registers at an address 0x08049196 in the register manager, the emulator will apply those registers when I Emulate program in new trace at that address. All general purpose registers will be applied except for the stack pointer.
image

By default the stack pointer will be set to some arbitrary value. In this example, it's set to 0x5000 but my register manager has the stack pointer set to 0xffffd2bc. The address 0xffffd2bc is inside a valid and initialized block in my Memory map.
image

Desired behavior
When starting the emulator at an address that has the stack pointer set in the register manager, I'd like the emulator to use that stack pointer by default, rather than having to manually editing the stack pointer after I start the new trace

@nsadeveloper789
Copy link
Contributor

That's a decent idea.

FWIW, an alternative is to create an uninitialized block called "STACK" in the Memory Map. The SP should get initialized to the highest address (maybe +1) in that block. Granted, that winds up applying to the entire program rather than just the specific function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Emulation Status: Triage Information is being gathered
Projects
None yet
Development

No branches or pull requests

3 participants