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

Is emitting text output possible? #54

Open
jamesblacklock opened this issue Apr 14, 2021 · 2 comments
Open

Is emitting text output possible? #54

jamesblacklock opened this issue Apr 14, 2021 · 2 comments

Comments

@jamesblacklock
Copy link

It would be extremely helpful to be able to dump a text version of the assembly to stdout as the code is being generated. Is this currently possible to do? If not, is this something that could be planned in the future?

thx

@CensoredUsername
Copy link
Owner

I've not thought of a feature like that, but it does sound interesting. Personally I've always just thrown generated bytes in a disassembler if I wanted to debug.

I'm thinking of how something like this could be implemented. The easiest would be to, per line, take the ast just after enough has been parsed to separate expressions from syntax, and then stringify that again to format strings with the relevant expressions executed. This means it won't contain stuff like actual jump offsets, but any expressions will be evaluated. That should be possible at least, but I'm not planning anything like that on the short term.

@jamesblacklock
Copy link
Author

Yeah, I hadn't thought through all of the details like jump offsets, but that sounds basically like what I was looking for. I may try to (partially) implement this as a declarative macro that calls dysnasm!().

Dumping the generated code to a file and using a disassembler will be extra trouble, but that could work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants