Hi all,

Just a generic question about debugging in GDB. Is there a good way to find the 
proper type of an `"object"` in GDB?

What I mean by that is, say there is an `AddNode` passed to a function as a 
`PrimExpr` and while debugging this function, is there way to find that it 
actually belongs to an `AddNode`. Trying `whatis object` or `ptype object` just 
prints that it's a `PrimExpr`.

I found a rather hacky way to do this by printing 

the `object.deleter_` if it's a subclass of `tvm::runtime::Object`, and 

`object.get().deleter_` if it's a subclass of `tvm::runtime::ObjectRef`

This prints the type of the `Deleter_` for that object and the template 
argument to the Handler contains the proper type (a sample output for `AddNode` 
is as shown below:)

> $65 = (tvm::runtime::Object::FDeleter) 0x7fffaf6c9300 
> <tvm::runtime::SimpleObjAllocator::Handler\<**tvm::tir::AddNode**\>::Deleter_(tvm::runtime::Object*)>

I was just wondering whether there's a stable/reliable way to get this info.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/finding-types-of-tvm-objects-and-accessing-their-attributes-in-gdb/10813/1)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/fcc7d26800a570a0d2a74d572e079afb29835b971d928b9bec57495984a67467).

Reply via email to