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

impl Struct functions are not found #26

Open
jeremysalwen opened this Issue Jan 9, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@jeremysalwen
Copy link

jeremysalwen commented Jan 9, 2019

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6193616cd6aa584793bcb730269a6eac

fn main() {
    let foo = Foo {x: 5};
    foo.print();
    println!("Hello, world!");
}

struct Foo {
    x :i32
}

impl Foo {
    fn print(&self) {
        println!("hello {}", self.x)
    }
}
#[test]
fn test_foo() {
    println!("Hello test");
    let _foo = Foo {x: 5};
    panic!();
}
$ rust-lldb target/debug/deps/exampledgb-0f6ba88c6ac57fe3
(lldb) command script import "/home/jeremysalwen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/etc/lldb_rust_formatters.py"
(lldb) type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
(lldb) type category enable Rust
(lldb) target create "target/debug/deps/exampledgb-0f6ba88c6ac57fe3"
Current executable set to 'target/debug/deps/exampledgb-0f6ba88c6ac57fe3' (x86_64).
(lldb) b main.rs:20
Breakpoint 1: where = exampledgb-0f6ba88c6ac57fe3`exampledgb::test_foo::h6982aa095a01d5c4 + 72 at main.rs:20, address = 0x0000000000011a28
(lldb) run
Process 196886 launched: '/home/jeremysalwen/fun/exampledgb/target/debug/deps/exampledgb-0f6ba88c6ac57fe3' (x86_64)

running 1 test
Process 196886 stopped
* thread #2, name = 'test_foo', stop reason = breakpoint 1.1
    frame #0: exampledgb-0f6ba88c6ac57fe3`exampledgb::test_foo::h6982aa095a01d5c4 at main.rs:20
   17  	fn test_foo() {
   18  	    println!("Hello test");
   19  	    let _foo = Foo {x: 5};
-> 20  	    panic!();
   21  	}
(lldb) p _foo.print()
error: no member named 'print' in 'exampledgb::Foo'
(lldb) 

@tromey

This comment has been minimized.

Copy link
Collaborator

tromey commented Jan 9, 2019

error: no member named 'print' in 'exampledgb::Foo'

I wonder whether you are using the rust-enabled lldb. In mine I get:

(lldb) print foo.print()
error: no field named print

That is, different error message.

@tromey

This comment has been minimized.

Copy link
Collaborator

tromey commented Jan 9, 2019

It seems I just forgot to implement this properly in the parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.