public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug rust/26202] New: Support calling methods on types
@ 2020-07-04  7:32 dxu at dxuuu dot xyz
  2020-07-04 17:19 ` [Bug rust/26202] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: dxu at dxuuu dot xyz @ 2020-07-04  7:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26202

            Bug ID: 26202
           Summary: Support calling methods on types
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rust
          Assignee: unassigned at sourceware dot org
          Reporter: dxu at dxuuu dot xyz
  Target Milestone: ---

For example, calling `Vec::len()` fails:

Breakpoint 1, rust_debug::foo () at src/main.rs:2
2           let v = vec!(1,2,3);
(gdb) n
3           println!("{:?}", v);
(gdb) p v.len()
Could not find function named 'alloc::vec::Vec<i32>::len'

It works for vectors in C++:

Temporary breakpoint 1, main () at main.cpp:4
4       int main() {
(gdb) n
5         std::vector<int> v{1,2,3};
(gdb) n
6         for (int i : v) {
(gdb) p v.size()
$1 = 3

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug rust/26202] Support calling methods on types
  2020-07-04  7:32 [Bug rust/26202] New: Support calling methods on types dxu at dxuuu dot xyz
@ 2020-07-04 17:19 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2020-07-04 17:19 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26202

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
I didn't look at the DWARF here, but in many cases the issue
is that rustc doesn't emit any information about traits; so
if a method is defined via a trait, then gdb simply can't know that.

Also, for C++, sometimes there are "xmethods" supplied by
libstdc++, so that this works even when the method is entirely
optimized away.  There's a gdb bug open about this topic
for Rust.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-04 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-04  7:32 [Bug rust/26202] New: Support calling methods on types dxu at dxuuu dot xyz
2020-07-04 17:19 ` [Bug rust/26202] " tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).