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

Visual debugging and profiling. #36

Open
mateli opened this issue Aug 14, 2024 · 3 comments
Open

Visual debugging and profiling. #36

mateli opened this issue Aug 14, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@mateli
Copy link

mateli commented Aug 14, 2024

  1. A machine code debugger that allows for live viewing of memory, current CPU registers, disassembly etc. This would be similar to many applications that use x86 debugging instructions to step trough an exe file although by integrating it with an emulator it can be used to figure out what an program actually are doing.
  2. A profiler that counts instruction executions to figure out where a program spends time.
  3. A live patcher. A patch specifies a memory location or a function call to replace with a call to a target native dll/so file. This can be used both to speed up programs and also to modify their behavior. Potentially this can be done in a way that is invisible to the guest application by having the emulator just recognize where the program counter enters the code to replace.
  4. For live patching it is useful to be able to replace parts of a function. For example the beginning of main could be replaced with native code that does something that is useful to do in native host-optimized code but then still run parts of the main function. It could also call some of the functions that are called from the original main functions while replacing others with target native code. This would allow an application to be gradually rewritten and translated to a modern programming language. Although it will only make sense to patch parts where features or performance can be improved.
@mateli
Copy link
Author

mateli commented Aug 14, 2024

Something like this for debugging: https://x64dbg.com/
Other inspirations (emulator based):
https://syncsim.sourceforge.net/index.php?show=screenshots
https://github.com/slatinsky/x86sim

@evmar
Copy link
Owner

evmar commented Aug 15, 2024

If you click one of the samples linked from the home page, there is a "view in debugger" button at the top. Click 'step' a few times to see some asm.

I can't tell from this if you are sharing a general idea, or requesting something specific, could you clarify?

@mateli
Copy link
Author

mateli commented Aug 27, 2024

I will do a bit more thinking on the debugger part of this issue as I see that there are a primitive debugger already implemented. The first thing that comes to mind is that there are no restart button. Also neither register content nor memory can be edited. Saving the application state (think action replay) in a format that can be reloaded would also be useful both in the debugger and directly from the emulator.

As for profiling that doesn't seem to be implemented at all. All I can think of here is to count how often the program counter visits a memory location and run an instruction.

@evmar evmar added the enhancement New feature or request label Sep 23, 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

2 participants