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

[cpp] Generate Sourcemap Style File #11590

Draft
wants to merge 52 commits into
base: development
Choose a base branch
from

Conversation

Aidan63
Copy link
Contributor

@Aidan63 Aidan63 commented Feb 21, 2024

Started this quite a while ago to try and improve the cpp target debugging experience by taking inspiration from the js world and have the compiler output a mapping file and then use DbgEng (underlying library of WinDbg and Visual Studio's debugger) to build a debugger which consumes that file. This worked pretty well and while I haven't worked on it much recently due to pulling out the libuv library from it to use as a base for asys, hxb among other things has had me thinking about it again recently.

So this PR is less about the changes as they are now and more about seeing what can be done to unify the various targets debug output and improve it further.

I originally didn't go with the js sourcemap format as its quite limited and at the time didn't know there was an extension mechanism in the standard to provide extra info, so my custom json could be binned. But there appear to be two source map generators in the compiler. One which is only used by the PHP generator and another which is used by js and lua. Which one should be used and is best open to extension to allow generators to provide extension data?

My format and js sourcemaps just contain a flat mapping between line and column positions, they don't store the original structure of the code. This can make implementing stuff like stepping a pain.
I was originally planning on dumping the entire ast in some sort of xml / heirarchy format to allow figuring out the best stepping behaviour for a given expression. I haven't look too deeply yet but it seems like hxb would be a good use for this.

Eventually I want to look at some of the stuff I mentioned in #10888 but thats a nice extra and I haven't figured out what and where the best way to store that info would be.

Aidan63 and others added 30 commits October 27, 2020 20:44
@skial skial mentioned this pull request Feb 22, 2024
1 task
@Simn
Copy link
Member

Simn commented Feb 24, 2024

Do you think we could move these additions to another file? gencpp.ml is a bit of a monster, and while I don't plan to refactor anything there, it would at least be nice to not feed it more than necessary.

@Aidan63
Copy link
Contributor Author

Aidan63 commented Mar 2, 2024

Yes, I remember thinking it might make sense to move it into another file when I was originally working on it. Hopefully once I get around to replacing my custom format with one of the existing sourcemap generators the diff will come down a lot so I'll see what it looks like then.

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

Successfully merging this pull request may close these issues.

None yet

2 participants