Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"Wiederhake, Tim" <tim.wiederhake@intel.com>,
	"xdje42@gmail.com" <xdje42@gmail.com>,
	"Joel Brobecker" <brobecker@adacore.com>
Subject: RE: GDB 8.0 release/branching 2017-03-20 update
Date: Tue, 28 Mar 2017 07:16:00 -0000	[thread overview]
Message-ID: <A78C989F6D9628469189715575E55B2340074E8B@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <86shlyoggb.fsf@gmail.com>

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

  reply	other threads:[~2017-03-28  7:16 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 20:16 Joel Brobecker
2017-03-20 20:21 ` Keith Seitz
2017-03-20 22:39 ` Yao Qi
2017-03-20 22:47   ` Yao Qi
2017-03-20 22:52   ` Joel Brobecker
2017-03-20 23:03     ` Yao Qi
2017-03-21 13:28       ` Joel Brobecker
2017-03-21  7:35     ` Wiederhake, Tim
2017-03-21 13:28       ` Joel Brobecker
2017-03-21 13:07   ` Yao Qi
2017-03-21 13:31     ` Joel Brobecker
2017-03-22 13:58     ` Metzger, Markus T
2017-03-22 17:09       ` Yao Qi
2017-03-23 16:01         ` Metzger, Markus T
2017-03-23 17:25           ` Yao Qi
2017-03-23 18:17             ` Metzger, Markus T
2017-03-24 14:41               ` Yao Qi
2017-03-27 10:51                 ` Metzger, Markus T
2017-03-27 11:19                   ` Yao Qi
2017-03-27 12:46                     ` Metzger, Markus T
2017-03-27 16:03                       ` Yao Qi
2017-03-28  7:16                         ` Metzger, Markus T [this message]
2017-03-28 13:25                           ` Yao Qi
2017-03-28 15:08                             ` Metzger, Markus T
2017-03-28 15:49                               ` Yao Qi
2017-03-29  6:08                                 ` Metzger, Markus T
     [not found]                                   ` <861stgo072.fsf@gmail.com>
2017-03-29 14:38                                     ` Metzger, Markus T
2017-03-30 10:50                                       ` Yao Qi
2017-03-30 11:58                                         ` Metzger, Markus T
     [not found]                                           ` <86h92a4w86.fsf@gmail.com>
2017-03-30 15:55                                             ` Metzger, Markus T
2017-03-31 13:55                                               ` Yao Qi
2017-03-31 15:21                                                 ` Metzger, Markus T
2017-03-31 16:02                                                   ` Joel Brobecker
2017-04-06 14:40                                                     ` Wiederhake, Tim
2017-04-07  8:10                                                       ` Yao Qi
2017-04-07 11:53                                                         ` Wiederhake, Tim
2017-04-07 15:19                                                           ` Yao Qi
2017-03-21 14:00 ` Yao Qi
2017-03-21 14:03   ` Pedro Alves
2017-03-27 13:35 ` Antoine Tremblay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A78C989F6D9628469189715575E55B2340074E8B@IRSMSX104.ger.corp.intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    --cc=tim.wiederhake@intel.com \
    --cc=xdje42@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox