Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upgdb needs to know what traits a type implements #33014
Comments
This comment has been minimized.
This comment has been minimized.
|
It occurred to me later that for operator overloading, I could perhaps just compute the method name directly in gdb. For example, However, there doesn't seem to be a way to tell whether this is I think it is still necessary to have information about traits attached to types, for other calls via traits. |
sanxiyn
added
the
A-debuginfo
label
Apr 19, 2016
Mark-Simulacrum
added
C-enhancement
C-bug
C-feature-request
and removed
C-enhancement
C-bug
labels
Jul 25, 2017
This comment has been minimized.
This comment has been minimized.
|
I thought I would write up a plan here; I probably am going to stop working on this, but this can serve as a guide to anyone picking it up in the future. The basic idea is to represent a concrete I started on an LLVM patch here: https://github.com/tromey/llvm/tree/interface-type. However, this patch is incomplete, as it does not allow interfaces to be attached to subroutine types, pointer types, or scalar types. Adding those would require a bigger change. Maybe the cleanest way would be to let the type base class hold any interface types. However, this is a pain due to the way this part of LLVM has been written. So perhaps handling this case-by-case on the concrete subclasses is simpler in practice. This approach will also require a small DWARF extension. DWARF 5, section 5.7.3, says:
This language is specific to class/structure/interface types. However, for Rust, this restriction should be lifted. It would make sense to file this as a DWARF issue; however, it may be best to wait until any patches have landed in LLVM first. |
tromey commentedApr 15, 2016
I'd like to make operator overloading work for Rust in gdb. That is, I'd like something like
print x+yto call the appropriate method on theAddtrait. I'd also like to make ordinary method calls work, where the method is defined in some trait that is impl'd for the concrete type of the object.Right now I think this can't be done. There is no information in the debug info about what traits are implemented by a type.
Consider:
Here
i32is described as just a base type:I think this might be a good spot to list all the impl'd traits. Perhaps they can be represented as DWARF interfaces; or maybe some Rust extension to DWARF would be preferable.
i32.Whatis emitted as a namespace:... but this isn't directly useful as it would require an iteration over all the namespace DIEs looking for matches. Maybe I could do this; but I'd rather not as it is very inefficient.