-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)O-macosOperating system: macOSOperating system: macOST-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Environment
- Operating system: macOS Mojave 10.14.4
- Rust toolchain: nightly-x86_64-apple-darwin
- Rustc version: 1.35.0-nightly (96d700f 2019-04-10)
Problem description
On macOS, when you build tests (with cargo test --no-run) in a lib target, and right after that run LLDB on the test binary, the debugger unable to resolve breakpoints.
Steps to reproduce:
Example project:
Cargo.toml:
[package]
name = "sandbox"
version = "0.1.0"
edition = "2018"src/main.rs:
fn main() {}
#[test]
fn test() { assert_eq!(2 + 2, 5) }src/lib.rs:
#[test]
fn test() { assert_eq!(2 + 2, 4) }Test script (bash):
test.sh:
#!/usr/bin/env bash
rm -rf target
EXE="$(cargo test --no-run --message-format=json --lib test 2>/dev/null | jq -r '.executable')"
sleep "$1"
lldb "$EXE" <<< "b test"- Delay 1 second before running the LLDB:
> ./test.sh 1
(lldb) target create "/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/sandbox-5d25a79faaa6e465"
Current executable set to '/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/sandbox-5d25a79faaa6e465' (x86_64).
(lldb) b test
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.- Delay 2 seconds before running the LLDB:
> ./test.sh 2
(lldb) target create "/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/sandbox-5d25a79faaa6e465"
Current executable set to '/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/sandbox-5d25a79faaa6e465' (x86_64).
(lldb) b test
Breakpoint 1: where = sandbox-5d25a79faaa6e465`sandbox::test::h95a153b117ba44e2 + 11 at lib.rs:2:23, address = 0x00000001000017bbP.S.
I also noticed that the *.dSYM file is not listed in the filenames field:
> cargo test --no-run --message-format=json --lib test 2>/dev/null | jq -r '.filenames'
[
"/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/sandbox-5d25a79faaa6e465"
]For example, build unit tests in bin target:
> cargo test --no-run --message-format=json --bin sandbox 2>/dev/null | jq -r '.filenames'
[
"/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/deps/libsandbox-006b5c7138cbbb04.rlib"
]
[
"/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/sandbox-94b9126e8bd84c57",
"/Users/mikhail.chernyavsky/Workspace/rust-sandbox/target/debug/sandbox-94b9126e8bd84c57.dSYM"
]ralfbiedert, sirgl, Nichts, BrannonKing, mrjoe7 and 9 more
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)O-macosOperating system: macOSOperating system: macOST-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.