Modify address of a gdb.Value
Niko Sams
niko.sams@gmail.com
Wed Jun 17 05:51:00 GMT 2009
> newval = (val.cast(Type('char').pointer()) - payload).cast(val.type)
that is working, thanks.
> Nobody has implemented inferior function calls using Value yet.
> So the payload() part is not implementable.
>
> If you know what it returns, or you can compute it in Python, then
> this is no big deal. You can use Value.cast to cast to some other
> type, then do pointer math.
I tried to implement this payload method in python, the c++ code is
the following:
template <class Key, class T>
struct QMapPayloadNode
{
Key key;
T value;
QMapData::Node *backward;
};
static inline int payload() {
return sizeof(PayloadNode) - sizeof(QMapData::Node *);
}
the obvious solution would be gdb.lookup_type('QMapPayloadNode<%s,
%s>' % (self.ktype, self.vtype)).sizeof
but that doesn't work, i get this error:
RuntimeError: No type named QMapPayloadNode<int, QString *>
This is because that QMapPayloadNode is not instanciated, it's only
used for this sizeof.
So any idea how i can compute the payload?
Niko
More information about the Gdb
mailing list