RemedyBG»Forums
Delicious Lines
9 posts / 2 projects
Feature request: stack trace and disassembly for arbitrary machine code

Hello,

I am working on a project where I run custom generated machine code that I load at runtime. Sometimes I need to inspect it using a debugger but Remedy does not show the disassembly when stepping into it (WinDBG does). It would also be nice to show the known stack trace up to that point (if that is possible of course).

Mārtiņš Možeiko
2567 posts / 2 projects
Feature request: stack trace and disassembly for arbitrary machine code
Edited by Mārtiņš Možeiko on

I don't know details of remedy debugger. But debugger usually needs extra support from application to properly unwind & walk the stack.

Is you generated code conforming to Windows 64-bit ABI? And are you calling RtlAddFunctionTable for generated functions - this function is needed to register unwind info for newly added functions to properly unwind & walk the stack.

315 posts / 1 project
None
Feature request: stack trace and disassembly for arbitrary machine code

Dynamically generated disassembly is not currently supported in the disassembly window. However, you can use a format specifier to disassemble a chunk of code:

addrress_expr, disasm [num_bytes_expr]

This specifier will disassemble 'num_bytes_expr' bytes of instructions starting at 'address_expr'. The 'address_expr' can be any expression that resolves to an address. The 'num_bytes_expr' expression is any expression that resolves to an integral value. It is optional and defaults to 128 bytes if not specified.

As Martins stated, when dynamic codegen is properly supported, you'll need to add a runtime function entry for unwinding / step-out to work as expected.

Delicious Lines
9 posts / 2 projects
Feature request: stack trace and disassembly for arbitrary machine code
Replying to x13pixels (#29534)

All right, I will look into this, thank you very much for the information!

13 posts
The classic game dev.
Feature request: stack trace and disassembly for arbitrary machine code
Replying to deliciouslines (#29537)

It is off topic to the post but I didn't find a way to DM OP so here I am.

@Delicious, I am also interested in generating code, putting it in a memory page, mark it as exec and run it but I have no clue where to start. Do you have some references / tutorials / books / conferences / code snippets ... ?

Cheers

Simon Anciaux
1341 posts
Feature request: stack trace and disassembly for arbitrary machine code
Replying to Scr3amer (#29566)

I think Casey shows a bit of that there: https://hero.handmade.network/episode/chat/chat013/#8051