Re: [PATCHv2 4/5] gdb: Introduce new language field la_is_string_type_p

Tom Tromey
2019-04-24T19:32:19Z

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> ...but, after prompting, I took a closer look, and rust_slice_type_p
Andrew> is only true for TYPE_CODE_STRUCT, which makes the union check
Andrew> redundant - so its gone!

Thanks.

>> Also, I think an array or slice of 'char' should probably be considered
>> a string in Rust. See rust_chartype_p.

Andrew> That sounds sensible, but .... I don't believe these things that you
Andrew> describe are currently printed as strings.

Thanks for looking into that. Maybe it's just an oversight in the Rust
code, or maybe it's just uncommon to do this kind of thing. Not your
problem :)

Andrew> You'll have noticed (maybe?) that the original patch didn't include a
Andrew> rust test at all. This was because some of rusts value printing seems
Andrew> a little broken right now. For example, printing an array slice
Andrew> (&str) variable works fine, but place this inside a struct and it no
Andrew> longer works, for example:

Thanks for noticing that. I can deal with it, unless you want to.

Andrew> So, I think the summary is, I'm happy to fix rust_is_string_p to cover
Andrew> any cases that currently print as a string, but I think that if
Andrew> something _doesn't_ currently print as a string then rust_is_string_p
Andrew> shouldn't identify it as a string - if it did then we'd end up
Andrew> printing a structure at a depth when it should have been replaced with
Andrew> ellipsis.

Agreed.

Tom