Skip to content
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

rust-lldb: cannot get backtrace on macOS #63266

Open
alexreg opened this issue Aug 4, 2019 · 2 comments
Open

rust-lldb: cannot get backtrace on macOS #63266

alexreg opened this issue Aug 4, 2019 · 2 comments
Assignees
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@alexreg
Copy link
Contributor

alexreg commented Aug 4, 2019

I have a breakpoint set on rust_panic, but when I hit this and then do bt, I get:

error: need to add support for DW_TAG_base_type '()' encoded with DW_ATE = 0x7, bit_size = 0
Traceback (most recent call last):
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 105, in print_val
    return print_std_vec_val(val, internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 254, in print_std_vec_val
    internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 289, in print_array_of_values
    return ', '.join([render_element(i) for i in range(length)])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 287, in render_element
    return print_val(element_val, internal_dict)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/alex/Software/rust-devel/src/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
TypeError: cannot concatenate 'str' and 'NoneType' objects
error: librustc_driver-f561ecb0e4be7b67.dylib DWARF DIE at 0x076fab13 (class closure) has a member variable 0x076fab1a (__0) whose type is a forward declaration, not a complete definition.
Try compiling the source file with -fstandalone-debug
Illegal instruction: 4
@jonas-schievink jonas-schievink added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 4, 2019
@nbigaouette
Copy link
Contributor

I have a similar (the same?) issue when trying to print a PathBuf when debugging.

This issue looks quite similar to #48462, probably a duplicate? Searching issues/pr for lldb_rust_formatters.py typeerror reveals a couple of hits.

I can see the vec![] content of the PathBuf if I print directory.inner.inner.

@nbigaouette
Copy link
Contributor

Similarly to #22656 here's a MRE:

debug.rs:

fn main() {
    let v = vec![1, 2, 3];
    let p = std::path::PathBuf::from("/usr/bin");
    println!("v: {:?}", v);
    println!("p: {:?}", p);
}
rustc -g debug.rs
rust-lldb debug

Now from inside rust-lldb:

(lldb) b debug.rs:4
Breakpoint 1: 2 locations.
(lldb) r
Process 70294 launched: '/var/folders/3z/mjcq38mx3610kl4gnt9zw3gw0000gn/T/tmp.GzBm67H2/debugtest/main' (x86_64)
Process 70294 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100002ad3 main`main::main::h9e0ea2b04575dfdb at main.rs:4:4
   1   	fn main() {
   2   	    let v = vec![1, 2, 3];
   3   	    let p = std::path::PathBuf::from("/usr/bin");
-> 4   	    println!("v: {:?}", v);
   5   	    println!("p: {:?}", p);
   6   	}
Target 0: (main) stopped.
(lldb) p v
(alloc::vec::Vec<int>) $0 = vec![1, 2, 3]
(lldb) p p
Traceback (most recent call last):
  File "/Users/nbigaouette/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 89, in print_val
    is_tuple_like = False)
  File "/Users/nbigaouette/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 210, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/Users/nbigaouette/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py", line 203, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
TypeError: cannot concatenate 'str' and 'NoneType' objects
(std::path::PathBuf) $1 = {
  inner = None
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants