Discussion:
[Bug rust/21893] New: template_argument(0) gives syntax error
jrmuizel at gmail dot com
2017-08-02 21:20:17 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21893

Bug ID: 21893
Summary: template_argument(0) gives syntax error
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rust
Assignee: unassigned at sourceware dot org
Reporter: jrmuizel at gmail dot com
Target Milestone: ---

Given the following program:

use std::collections::HashMap;

fn main() {
let m : HashMap<u32, Vec<u32>> = HashMap::new();
println!("Hello, world! {:?}", m);
}

print(gdb.parse_and_eval("m")["table"].type.template_argument(0))

gives a:

RuntimeError: syntax error, near `>>'
Error while executing Python code.
--
You are receiving this mail because:
You are on the CC list for the bug.
jrmuizel at gmail dot com
2017-08-02 21:20:35 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21893

Jeff Muizelaar <jrmuizel at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2017-08-02 23:34:53 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21893

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
This happens because rustc doesn't emit DW_AT_template_type_param for
the HashMap type.

Then it interacts with a weird gdb/python thing -- in earlier times gcc
also did not emit this template information, so the first iteration of
this python layer code hacked around the omission by parsing the C++
name and extracting the type names. This code remains, so it still tries
to do this as a fallback.

I think this is apropos: https://github.com/rust-lang/rust/issues/9224
--
You are receiving this mail because:
You are on the CC list for the bug.
jrmuizel at gmail dot com
2017-08-04 00:47:21 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21893

--- Comment #2 from Jeff Muizelaar <jrmuizel at gmail dot com> ---
https://github.com/rust-lang/rust/issues/9224 seems to suggest that rustc is
emitting DW_AT_template_type_param
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2017-08-05 21:49:17 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21893

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Jeff Muizelaar from comment #2)
Post by jrmuizel at gmail dot com
https://github.com/rust-lang/rust/issues/9224 seems to suggest that rustc is
emitting DW_AT_template_type_param
Not always. Consider this test (from that bug):

pub struct Generic<T: Clone>(T);
pub struct Normal(i32);

fn main () {
let generic = Generic(10);
let normal = Normal(10);
generic;
normal;
}

Here the DWARF for Generic<i32> is just:

<2><81>: Abbrev Number: 6 (DW_TAG_structure_type)
<82> DW_AT_name : (indirect string, offset: 0x6e): Generic<i32>
<86> DW_AT_byte_size : 4
<87> Unknown AT value: 88: 4
<3><88>: Abbrev Number: 7 (DW_TAG_member)
<89> DW_AT_name : (indirect string, offset: 0x66): __0
<8d> DW_AT_type : <0xa8>
<91> Unknown AT value: 88: 4
<92> DW_AT_data_member_location: 0
<3><93>: Abbrev Number: 0
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-10-12 13:37:38 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21893

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-10-12
Ever confirmed|0 |1

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
See https://github.com/rust-lang/rust/pull/55010
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...