-
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
LLDB is not able to find default source location #33674
Comments
I see this on Linux as well. |
This might be a symptom of the compiler not emitting the DW_AT_main_subprogram attribute. |
OK, I found the problem: LLDB is looking for a function named "main" when it tries to determine the default location in the source code. Since the compiler generated main function (the one wrapping the user-defined main function) does not have debuginfo attached, LLDB won't find anything. The correct way to handle this would probably be to emit Maybe |
I didn't find anything that |
It's low priority in that it's not a big deal, and it's easy to work around, but it does give people a negative impression, as the comment leading to the report suggests. Maybe this is something that's not a big deal, but might not be hard and lead to some perception gains? I don't know anything about generating debuginfo, so I don't know how tough it actually is... On May 23, 2016, 18:49 -0400, Michael Woeristernotifications@github.com, wrote:
|
I'll take at look how GDB finds the correct function and see if that can help us here in any way. However, really fixing this would mean not only extending rustc, but also LLVM and LLDB. LLVM does not currently give us a way of marking the entry function correctly (via adding the |
Is there an easy workaround for this issue ? If yes, what is it ? |
Yes, you can just manually set a breakpoint wherever you want. You just have to specify the file you want to set the breakpoint in (which you would have to do anyway if your program has more than one source file). |
Thank You very much. I can set breakpoints, but I am not able to see the source code. settings set target.hand-written-source-paths ./src/main.rs http://main.rs/ ./src/somewhere.rs http://somewhere.rs/ ... To get the sources into rust-lldb.
|
The debuginfo in your binary should store the paths to your source files. How are you compiling your program? Maybe you don't have debuginfo enabled? |
Debugging info should be available, look: Versions: Content Cargo.toml: Build: After running into Breakpoint in "main": |
Yes, that looks like debuginfo should be contained in your executables.
This is unfortunately an unsupported version of LLDB (see #32520 for more information). The next version of LLDB will not have this problem anymore (older versions didn't have it either). If you are adventurous, you can also build your own version of LLDB. |
This works with
|
LLDB works fine for me when compiling a single More info: https://www.reddit.com/r/rust/comments/6b8blv/hey_rustaceans_got_an_easy_question_ask_here/dhm7842/ |
So, the problem is that |
Interesting. @alexcrichton, is Cargo moving the executable after generating it in |
I posted a cargo issue: rust-lang/cargo#4056 |
Excellent, thank you @golddranks! |
This comment has been minimized.
This comment has been minimized.
Can this please be reopened? I am also seeing empty output from |
I can't reproduce this.
I did initially think that I could reproduce this given that the first breakpoint does not have any source-level debugging information but the program entry point is not defined in the crate's source code and our Is there any chance that you made this mistake too @NickHu? |
I have the same issue. I'm trying to explore lldb according to Apple's tutorial on the Swift website, but nothing shows when I do various commands. |
@kit-981 I have something that might help. Follow this tutorial. Then, try making some Rust code that's as close as possible to the C++ code. You should be able to reproduce the tutorial and find why LLDB isn't doing what you expect. For example, I'm currently using this Swift program, which is my best translation from C++: import Foundation
import Swift
func my_subroutine() {
print("Hello world" + "\n")
}
do {
var x: Int32 = 4
var p = unsafeBitCast(Int(0), to: UnsafeMutablePointer<Int32>.self)
my_subroutine()
p.pointee = 3
print("\(x)" + ", " + "\(p.pointee)" + "\n")
} Edit: right after making this comment, I found out that only the |
I'm also hitting this, but only for certain commands (which is why there may be confusion and "no repro" above). I'm using Rust 1.76.0 and LLDB 17.0.6. Been trying for days to see if I'm doing something wrong, setting various paths & settings, launching from different directories, etc., all to no avail. As a bit more context, MOST debugging is working fine. I can even set breakpoints using the source file and line syntax, and they indeed get hit. I can also show the source lines via symbol name OK, which reports the filename correctly. It's purely using the 'source list' with a file that says it can't find I've tried using both 'cargo build' and 'rustc -g main.rs' directly with no difference. Example session below highlighting most things working, but see the last couple of lines where 'source list -f main.rs' is not.
If I do the same thing with a C file compiled with
|
I tried this:
I expected LLDB to actually be able to associate an executable compiled with debugging information to be able to list source code and set breakpoints. Compare GDB's support on the same machine (gdb 7.11 built from homebrew and self-signed for debugging privileges):
LLDB seems functional otherwise, with sources compiled with Clang
If anyone's curious, the rust-lldb wrapper does nothing to alleviate this (nor is it intended to AFAIK):
Meta
This rust was installed from Homebrew. This issue also occurred with 1.7.0.
The text was updated successfully, but these errors were encountered: