-
Notifications
You must be signed in to change notification settings - Fork 13k
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
demangled characters like { make debugging annoying #37646
Comments
See also issue #32925. In some cases the linkage name in the debuginfo disagrees with the actual linkage name. For impls I think a more comprehensive DWARF emission approach is needed. A few of us have a google doc on this topic but most of it hasn't been turned into bugs or an RFC or whatever yet. I haven't given the naming of closures any thought. It's important, though, to separate what is put into the mangled name and what sort of information is emitted in the debuginfo. For breakpoints, |
I think we could switch from Is there a character that cannot be part of a valid Rust identifier but works with GDB's about-completion? |
@tromey would know better than me. Just to be clear, I like the brackets around closures, it's just they don't play nice. __ seems ugly to me, but will do if all else fails. I like idea of different char for bracket that plays nice. I wonder if | will work (also it evokes closures, but I digress)? |
Can square brackets or angle brackets be used? |
FWIW I now tend to think this is just a bug in gdb (and lldb) and should be filed there instead. (The bugs about things like In gdb there are two ways to refer to items. One is "linespecs", which is the syntax you use for The other way to refer to items is via expressions. It's normal in gdb to add a language extension to let one refer to unusual names this way -- for C this is done using single quotes. Perhaps that would work ok for rust as well. For lldb I'm less sure about the linespec equivalent, but we do completely control the expression parser at least, and can make it work however we like. |
This is still an issue and I’m still not able to print things or break on them with {{ with quotes, single quotes, without, etc. Alternatively quoting demangled cpp names works as expected. Since I filed this 2 years ago and no action has been taken to fix it in gdb can we just not emit these symbols in rustc ? |
Discussed in wg-debugging triage We propose that a community member should file a compiler MCP here, suggesting that we change the choice of symbol name to better accommodate this scenario. @wesleywiser says that |
(in gdb at least)
I think I complained to @tromey about this already and he proposed a solution, but I'm finding this more and more annoying when debugging that the '{' was chosen demangle to, for closures and impls, e.g.:
_ZN4clap4args3arg3Arg5short28_$u7b$$u7b$closure$u7d$$u7d$17h7c4595ce99cae01bE
demangles to:
clap::args::arg::Arg::short::{{closure}}::h7c4595ce99cae01b
as it breaks gdb's symbol auto-complete, it's hard to set a breakpoint, print the type, etc.
As I mentioned, I think @tromey suggested how to fix this with certain gdb expressions, or some work around, but I've already forgotten and maybe we should just make it demangle to something different ? 👼
The text was updated successfully, but these errors were encountered: