This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB 8.0 release/branching 2017-03-20 update


"Metzger, Markus T" <markus.t.metzger@intel.com> writes:

Hi Markus,

> Now I'm a bit lost.  What exactly do you want changed at this point to
> establish the Python interface?

I requested the change to Python interface, as described
https://sourceware.org/ml/gdb-patches/2017-03/msg00366.html and the
python interface is implementable, nothing odd or fancy there.  I want:

 1, we agree on that new python interface,
 2, decide we either change the python interface according to my
 proposal before 8.0 release or release 8.0 without these record
 (btrace) python interfaces.

I've never suggest anything on the implementation of the CPython code
for the python interface.  Anything reasonable is good to me, and we are
free to change them because they are internal things.  How to establish
such python interface is a little bit out of the scope of this
discussion, but let me try again to make it clear.

In my proposal above, we have Python classes,

Instruction
{
   pc, data, decode, size;
};

RecordInstruction : Instruction
{
  sal;
  is_speculative;
}

Record.instruction_history returns a list of RecordInstruction objects.
Instruction can be used for disassemble in Python.  Note that how does
these attributes get data is the implementation (C code) details.  We
have two approaches,

 a) copy all the data into the internal structure when the object is
 created, and the "get" function just returns the data in the internal
 structure,
 b) get the data from gdb when the attribute is accessed,

Now, let us dive into C code, and py_insn_getset is for Python class
Instruction,

 struct PyGetSetDef py_insn_getset[] =
  {
   { "data", py_insn_data, NULL, "raw instruction data", NULL},
   { "decoded", py_insn_decode, NULL, "decoded instruction", NULL},
   { "size", py_insn_size, NULL, "instruction size in byte", NULL},
   { "pc", py_insn_pc, NULL, "instruction address", NULL },
   {NULL}
 };

We are free to choose approach a) or b) for functions py_insn_data and
py_insn_pc.  Python class RecordInstruction has its own getset.
If the py_insn_data's behavior is what RecordInstruction expects, just
use it, otherwise, overwrite its own function.

-- 
Yao (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]