-
Notifications
You must be signed in to change notification settings - Fork 200
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
Improve debuggability of IEnummerable<T> MoveNext methods #660
Comments
Hm, the cordebuginfo.h protocol doesn't currently allow specifying that a local is placed behind an indirection. Wondering whether COFF/DWARF allow that in the first place. Wondering if the easiest thing we could do is to
Maybe do all of this only if we're building debug. RyuJIT is likely to optimize the locals away anyway. |
I expect that people typically need to debug optimized retail binaries with NativeAOT. I do not think it is worth it to spend time on solutions that only work when building debug. |
Maybe using the same kind of debug records that C++ uses for lambda captures would work: #include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
int main()
{
std::vector<int> c = { 42, 1, 8 };
int fhtagn = 5;
int phnglui = 8;
c.erase(std::remove_if(c.begin(), c.end(),
[fhtagn, phnglui](int n) {
return n < (fhtagn + phnglui);
}), c.end());
} The captured locals are hoisted into a class but the debugger shows them as normal locals. This looks like the thing we need. I've reached out the the C++ team to help me find the CodeView incantation to do it. Then we'll need the relevant Dwarf incantation too. |
#735 fixes a lot of the experience. The variable still don't show up as proper locals, so keeping open for now. |
Rust change that makes locals appear properly: rust-lang/rust#83941 If I understand it right, it creates additional variables and points them to the fields on the capture. The comments do have pointers on how to do this properly in DWARF ( |
Improve debugging experience for IEnummerable MoveNext method (when yield is used in a method). Switching to .frame N and then dumping local variables via dv /t /v results in no local variables and __this being unavailable.
The text was updated successfully, but these errors were encountered: