Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] [DSF] SessionType

 

> -----Original Message-----
> From: Vladimir Prus [mailto:vladimir@xxxxxxxxxxxxxxxx] 
> Sent: Thursday, July 08, 2010 12:39 PM
> To: cdt-dev@xxxxxxxxxxx
> Cc: Marc Khouzam
> Subject: Re: [cdt-dev] [DSF] SessionType
> 
> On Thursday 08 July 2010 19:48:59 Marc Khouzam wrote:
> 
> > > -----Original Message-----
> > > From: cdt-dev-bounces@xxxxxxxxxxx 
> > > [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Vladimir Prus
> > > Sent: Thursday, July 08, 2010 6:17 AM
> > > To: cdt-dev@xxxxxxxxxxx
> > > Subject: [cdt-dev] [DSF] SessionType
> > > 
> > > 
> > > Hi,
> > > I'm looking at this definition from DSF:
> > > 
> > > 	public enum SessionType { LOCAL, REMOTE, CORE }
> > 
> > This is DSF-GDB specific.  (just to be fair to DSF :-))
> > 
> > > Unfortunately, despite quite some years of experience 
> with gdb, I have
> > > no idea what LOCAL and REMOTE means. 
> > 
> > REMOTE is when we connect to a gdbserver.
> > LOCAL is when we use GDB on the host only.
> 
> And what if we connect to something that speaks gdb protocol, 
> but is not a gdbserver?

Sure, but when I wrote this class, it was focused on the 
functionality of DSF-GDB, which only supports gdbserver.

> > > Would it not be better to remove session type completely, and use
> > > more detailed switches, like 'should run or continue to be used
> > > when starting program', or 'run can be used to restart'.
> > 
> > If the problem is using -exec-run or -exec-continue, then the
> > service which dispatches those commands can be overridden to handle
> > the cases you want to deal with.
> 
> I am becoming somewhat concerned :-( You seem to suggest that
> overridding a service -- that is, writing my own service class
> and doing what I want -- is a sensible approach.

Yes.  That's DSF.

> However,
> suppose I want to go this route. I'll derive from GDBControl_7_0

You don't even have to do that.  You can create your own service
altogether.

> and what is the next step? startOrRestart method is pretty big,
> and all I want to do is modify a single if condition inside it.
> Clearly, copy-pasting it is not a good approach 

Yes, no one likes copy-pasting, but at some point it is
unavoidable.  Your case requires to modify a single if condition,
while someone else may need to modify some other tiny part
of the same method.  At some point, we can't make every little
behavior customizable.

> and there
> are no methods that encapsulate 'should I use run' decision.
> Are you proposing to add 'useRun' method to GDBControl_7_0, or
> there's some other approach?

No, methods that you want to access in a service should be in
an interface, or else you will run into problem if you need
to have more than one version of the same service (e.g.,
service_7_0 and service _7_1).

Marc

> 
> Thanks,
> 
> -- 
> Vladimir Prus
> CodeSourcery
> vladimir@xxxxxxxxxxxxxxxx
> (650) 331-3385 x722
> 

Back to the top