-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
(Ubuntu's) lldb doesn't print stack variables #33062
Comments
Yeah, I noticed this too and newer versions of LLDB seem to have the same problem on OSX. So far, LLDB hasn't gotten any attention outside of OSX but maybe this problem is the same underlying problem. I'll start debugging this next week when I find some spare time. |
it's probably something about the debug information (DWARF) for the function that's causing the problem, unlikely to be platform (Ubutu/linux/etc) specific. When |
I'd recommend checking out a copy of the current lldb sources from http://lldb.llvm.org and seeing if that works better. The linux support in lldb has matured greatly over the last year and depending on when your linux distro's copy of lldb was made, it may be missing important support for e.g. "dwo" files. |
So, I spent the whole day trying to track this issue down and finally found it in the last place I would have suspected it: LLDB seems to have changed its behavior when encountering a compilation with an unknown This is a bit of a problem since I'd prefer not to emit cc @rust-lang/compiler @rust-lang/tools |
Whoa, nice find! Could you expand on the downsides of just marking ourselves as C++ for now? It seems like that may be our only course of action in the near future, unless there's perhaps a way for Looking forward, maybe we could try to beef up |
Nice detective work. The proper solution would be to add a rust parser to lldb (see You may want to ask about this "if we don't know what language it is, assume a C family language" assumption on the lldb-dev mailing list. I wasn't paying attention when that change went in, but I imagine it was made because the chance that the debugger would behave poorly was high. Another example of a language added to lldb, but not in the lldb.llvm.org repository, is the swift support. All of that support is over at swift.org (github repositories) - the swift language support pretty cleanly drops on top of lldb (the model being designed os that additional languages can be added by other groups). Like the C-based languages that use clang as the front end, the swift support uses the swift compiler as its front end. This is a large amount of code, of course, and assumes there's a compiler structured in the form of a library and probably having to emit LLVM IR etc. |
@jasonmolenda Thanks for the pointers to other language implementations.
That's definitely the long term solution to this problem.
I assume it just fell out of adding support for language plugins. |
The practical downsides would be negligible, I guess. We couldn't rely on debuggers doing anything Rust specific before and C++ is the closest thing. I thought, there might be some benefit in choosing a value that is definitely not a known language (e.g. In the long run we just need a proper language plugin for LLDB.
I don't think there's a way to do that, unfortunately. |
You can do PS. Apologies for butting in, it's just that I'm interested in this issue as well and I've been debugging it today out of curiosity (see https://users.rust-lang.org/t/rust-lldb-not-printing-out-local-variables/3980/6 and http://stackoverflow.com/questions/36621130/how-can-i-inspect-variable-values-while-debugging-msvc-abi-rust-programs). |
Could we ship a language plugin with rust that just redirects lldb to C++ (and later improve on it so it's smarter)? |
My two cents: The right solution is for the rust files' debug info to use Emitting no |
@jasonmolenda "All of that support is over at swift.org (github repositories) - the swift language support pretty cleanly drops on top of lldb (the model being designed os that additional languages can be added by other groups). " So does swift ship a dylib plugin or something? Can we do the same thing in a bare-bones way and just have it redirect to C++ for now? |
If that's not possible, I suggest we patch lldb asap so that it treats DW_LANG_RUST as C++, and by the time that reaches a release we can switch to emitting DW_LANG_RUST by default so that the gdb thing is more widely useful. If this language switch flag is to be kept around for a long time we'd need |
lldb is hosted over at http://lldb.llvm.org (not github, unfortunately). Check out the sources (svn or there's a read-only git mirror) and make the change I suggest above -- verify that it works correctly & is sufficient for your rust program when it calls itself |
Thanks. I personally don't have enough space right now for an extra LLVM+LLDB build (no time either, and already working on gdb stuff). Is anyone else up for this? |
@Manishearth I'll look into it. |
To give an update on this: The issue with LLDB not printing anything is mitigated in the open-source version of LLDB for a few weeks now -- i.e. the "old" behavior of falling back to Clang-mode for Rust has been restored and will stay in place until a proper Rust plugin gets written for LLDB. The versions of LLDB distributed with XCode over the last few months, on the other hand, do not include this fix. I don't have any insight into how fast the fix will show up in Apple's binaries. |
I cherry-picked the change on to the swift 3.0 branch for lldb, and it is included in the Xcode 8.0 preview release to apple developers that went public today. |
Ah, nice! Thanks for the update! But what about Linux distros that bundle LLVM 3.8? (is that when the breakage started?) |
Ah, I'm afraid I don't follow the llvm release branches, mostly just the apple side of things, so I can't comment on that. I knew it was important to get this patch into distributions and made sure it would be in Xcode 8, but didn't think to look into the llvm releases. |
This works in LLDB 3.9+ |
Note: This issue isn't Ubuntu specific as I observe the same issue on the obscure Linux distribution I use everyday.
STR
lldb
doesn't print stack variables, butgdb
does:And
lldb
can print stack variables just fine when used with C programs:I'm not sure what's going on. Do I need some extra steps to make lldb fully work with Rust programs? I tried
rust-lldb
but I get the same behavior.Meta
cc @michaelwoerister
The text was updated successfully, but these errors were encountered: