-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Add renaming of PDB files to avoid blocking them #87117
Conversation
0e80818
to
bce0871
Compare
After a strange bug with breakpoints in
Visual Studio bugIn my testing onlyVisual Studio has the breakpoints bug. Of course, there are other IDEs and debuggers, but I have not tested them.
Example of a bug: vs.mp4 |
Thanks! Overall, I think pursuing the approach of copying the PDB file is the right way to go. However, I'm not sure about a couple of things:
|
Yeah I knew it would probably lead to a discussion, but I didn't want to embed 200 lines of Windows-specific code either.
There's a problem with that. This won't be a problem for some debuggers, but Visual Studio will block the removal of the PDB (at least one). |
As a general rule platform code should not be bundled into anything outside of the each platform's respective folder. This allows for platforms to remain modular and for new platforms to be able to use all of the existing framework without patching the engine. I can see in this case that there is already a bunch of platform-specific code in the modified file. So it's tempting to say that this is okay as is. However, your example of |
I think one debugger (even a popular one) having issues with cleaning up the PDB when the editor shuts down is probably acceptable. We'll always need code to clean-up or overwrite a left over PDB when the editor starts up again, because the editor can always crash before it's clean up can run. But I think attempting to clean up (and only making one copy in the first place) is important to try to do. |
c8ae398
to
9feb2cc
Compare
Added HashMap for storing temporary PDB files. |
Do I need to make any other edits? |
9feb2cc
to
52a2476
Compare
Done. |
Thanks! This is looking really great to me :-) I did some testing (although, I'm not the best person to test Windows and MSVC stuff). When building my extension with gcc (which doesn't use a PDB file), it correctly did nothing with no complaints. :-) Then with MSVC, it seems to be working correctly: the PDB file got renamed, and it still stopped on my breakpoints. I can confirm the behavior where the PDB file doesn't get cleaned up at exit when debugging with MSVC, but I don't think there's any more we can do about that. The only remaining open question is if it's OK that We have a couple of workarounds to this where all platforms have a specific header, like @akien-mga What do you think? Is the direct |
Yeah this needs to be changed, |
I haven't thought about this too deeply, but I wonder if we could put the PDB copying logic (and the existing DLL copying logic) into Android has a bunch of custom copying logic in its |
So you want me to move all Leave the |
Well, so far it's just an idea - I haven't thought through it far enough to know if it's a good idea or not. :-) If you take a look at it and it doesn't seem like there'd be any problems, then give it a try.
Right now, we make the temporary copies when
I think either way would fine. Within |
I found the use of I'm thinking of adding another argument to |
bb6b657
to
fa24cdc
Compare
|
108930f
to
8b925b4
Compare
Discussed at the GDExtension meeting, and we think moving the Windows-specific code into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking so long to come back to this yet again!
However, I reviewed the code in-depth and it looks great to me. I also re-did the same Windows testing I did earlier, and everything still seems to be working fine. :-)
This needs to be re-based (there are conflicts now), but after that, I think this is ready to go!
8b925b4
to
b73e740
Compare
In #89677, the paths in |
Is there a chance of merging before 4.3 is released? |
I'd personally really love to see this merged for Godot 4.3 - this fixes a very common complaint from folks using godot-cpp with MSVC. And, yes, at this point, there still is a chance :-) |
Thanks! |
Fixes #82536
Supersedes godotengine/godot-cpp#1331
In this implementation, I patch the copied ~DLL by replacing the PDB path in it with a new non-blocked path. Actually, all that is left of the PDB path is the file name, so that the new name almost never goes beyond the existing
CODEVIEW
entry.Strangely, while I was testing this implementation the debugger did not block more than one PDB file, whereas in python/scons implementation PDBs were blocked until the debugger was restarted. If PDBs will be blocked until the debugger is restarted, 1000 copies of the PDB can be created.
I also noticed that
vscode
andvs
load debug symbols with no problem, butvs
doesn't update the breakpoints state and they have to be manually recreated.If the DLL is renamed, then the PDB too, and previously created copies of it will not be deleted automatically.
Also, if a version without debug symbols is built, past previous will not be deleted.
Tested only with
godot-cpp
andmsvc
.