This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: GDB 8.0 release/branching 2017-03-20 update
Hello Yao,
> > RecordInstruction wants to store ptid and insn# and compute pc, data, and
> > disassembled string from those. It may need to read memory from binaries
> > that have already been unmapped. But we only want to read memory if we
> > really have to, so we can't just store the memory in the Instruction object.
> >
>
> They are all about internal representation, aren't they? Let me be
> clear, "internal representation" is about the C code, not python one.
Correct. I am only talking about the internal representation. This was to clarify
that we need to overwrite all inherited functions and that we will have a different
set of data members for each variant.
> > DisassembleInstruction can't use ptid and insn# since insn# doesn't mean
> > anything outside of record targets. It will need to store different information
> > from which it can compute pc, data, and the disassembled string.
> >
> > While they provide the same interface (i.e. member functions) to the user,
> they
>
> "the same interface" is python interface or c interface? I assume you
> meant python interface.
Yes, I was referring to the Python interface.
> > store different information internally and they use different
> > algorithms. In C++
> > I would model this with an abstract base class. How would one model
> > this in Python?
> >
>
> We can have the same interfaces in Python but with different
> implementations in CPython. Suppose we have a base class Instruction in
> python, and it has attributes, pc, size, data and decoded. Its CPython
> implementation is what current BtraceInstruction does, which only gets
> contents when they are accessed. However, we are free to change the
> implementation to store all needed contents when the object is created.
> Classes Instruction, BtraceInstruction, and FullInstruction can have
> their own functions to access these four attributes in different ways.
> The key point is that record.instruction_history (in Python) return a
> list of objects which has these four attributes in common. It doesn't
> matter in Python on how to get their value/contents.
That sounds good. We want to provide a fixed set of functions and we want
to be free to choose the best internal representation for each variant.
How would this look in our python implementation?
> >> > What won't work is that we simply extend an Instruction base class by
> >> > adding new functions and data members. We need to overwrite every
> >> > function in the base class and each derived class will provide its own set
> >> > of data members to work on.
> >>
> >> I don't expect the change like that.
> >
> > I didn't understand your comment. Would you please rephrase it?
>
> What I meant is that I don't expect adding *new* functions or data members
> in the base class, but I don't see why can't override function in the
> base class.
Thanks. In addition to overwriting base class functions, BtraceInstruction will
add a sal function. My point was that this won't be enough and it looks like we
agree on this.
Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928