public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: Register group proposal
@ 2001-02-21  3:00 Stephane Carrez
  2001-02-21  7:00 ` Nick Duffek
  2001-02-21  9:34 ` Andrew Cagney
  0 siblings, 2 replies; 47+ messages in thread
From: Stephane Carrez @ 2001-02-21  3:00 UTC (permalink / raw)
  To: nsd; +Cc: gdb, fnasser, insight

Hi!

>
>On an architecture with a large register set, GDBtk's register window can
>be difficult to read and slow to update.  Users can customize the window
>to hide individual registers, but that's a tedious procedure.
>

Yes. It really makes sense.

For ChorusOS, we have this notion of 'grouping'.  The DebugAPI allows
to retrieve all registers of a given group.  Until now, we have defined
three groups (could define more):

 - general registers (ie, r0..r31, eax, ...)
 - floating point registers (ie, f0,...)
 - specific registers (ie, sprg0, dbat, cr0, ...)

In most cases, you are interested to look at general registers or floating
point regs.  Less often, you will need to display the specific registers.


It would be interesting then to take the 'grouping' into account by
the new/next register API. The current semantics of `to_fetch_registers()'
when a -1 is passed is to fetch all registers. You can see that as
a group of all registers. I think it's then necessary to clarify or
extend this semantics.

The goal is that if someone asks for the general registers, we don't
have to fetch the specific/floating point registers.

Well, this is very close to a previous discussion about optimizing
the fetch of registers within all GDB sources (frame, backtrace, locals, ...)

>
>The CLI "info registers" command already accepts a register name as an
>optional paramter.  It could be extended to try that parameter as a group
>name first and a register name second, so e.g. "info registers float"
>would display all floating-point registers.
>
>What do you think?
>
>Nick

It's great if a given platform could define its own groups of registers
and that they are recognized by Insight after that.

What about plugging the grouping in your regs_init_*() functions?

	Stephane

-	-	-	-	-	-	-	-	-	-
Stephane |Sun Microsystems			|
 Carrez	 |Network Service Provider Division	| http://www.sun.com
	 |6 avenue Gustave Eiffel		|
	 |F-78182, St-Quentin-en-Yvelines-Cedex |

email: Stephane.Carrez@France.Sun.COM


^ permalink raw reply	[flat|nested] 47+ messages in thread
* RE: Register group proposal
@ 2001-02-28  1:59 Bernard Dautrevaux
  0 siblings, 0 replies; 47+ messages in thread
From: Bernard Dautrevaux @ 2001-02-28  1:59 UTC (permalink / raw)
  To: 'Jim Kleck', Andrew Cagney
  Cc: Nick Duffek, Bernard Dautrevaux, gdb, insight

> -----Original Message-----
> From: Jim Kleck [ mailto:jim.kleck@NetergyNet.COM ]
> Sent: Tuesday, February 27, 2001 7:32 PM
> To: Andrew Cagney
> Cc: Nick Duffek; Dautrevaux@microprocess.com; gdb@sources.redhat.com;
> insight@sources.redhat.com
> Subject: Re: Register group proposal
> 
> 
> A consistent interface is *one* reason to have a particular interface.
> However, it is not the only thing to consider, nor have the "style
> advantages and disadvantages" been fully explored... at least not
> in this forum.
> 
> I would note that "struct blah *" is NOT fully opaque. Its 
> very use implies
> a control structure of some sort, and it is quite different 
> from the standard
> types provided by the language. Thus it is not using the full 
> "extensability"
> of the language.
> 
> An alternative I have not seen discussed is to have "typedef 
> void * blah"
> as the public interface (then the implementation would need to cast
> the object to the internal representation before operating on it).
> 
> Finally, in the "LONGEST" example, why replace "a = b + c;" with
> "a = add(b, c);". My inclination would be to overload the "+" so that
> no change to the users of the type are necessary.
> 

I'm afraid GDB is written in C isn't it? so overloading '+' is not really an
option. 

Regards,

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 

^ permalink raw reply	[flat|nested] 47+ messages in thread
* RE: Register group proposal
@ 2001-02-26  5:29 Bernard Dautrevaux
  2001-02-26  9:28 ` Christopher Faylor
  0 siblings, 1 reply; 47+ messages in thread
From: Bernard Dautrevaux @ 2001-02-26  5:29 UTC (permalink / raw)
  To: 'Nick Duffek', Bernard Dautrevaux; +Cc: gdb, insight

> -----Original Message-----
> From: Nick Duffek [ mailto:nsd@redhat.com ]
> Sent: Sunday, February 25, 2001 12:52 AM
> To: Dautrevaux@microprocess.com
> Cc: gdb@sources.redhat.com; insight@sources.redhat.com
> Subject: RE: Register group proposal
> 
> 
> On 23-Feb-2001, Bernard Dautrevaux wrote:
> 
> >Perhaps for avoiding an unneeded dependency, that would 
> trigger superfluous
> >recompiles of users of "abc.h" that do not need "xyz.h" if "xyz.h" is
> >modified?
> 
> I agree that's a pain.  But prohibiting typedefs only avoids a small
> subset of superfluous recompiles.  For example, changing a 
> single macro in
> gdbarch.h causes a massive rebuild.
> 
> Eventually, GCC probably will support header file compilation, which
> probably will lead to fully-accurate dependency generation.  This will
> eliminate superfluous recompiles.
> 
> In the meantime, the problem diminishes as hardware speedups 
> outpace GCC
> complexity.
> 
> However, humans won't ever get better at writing maintainable code or
> understanding existing code.  Typedefs help us achieve both of those
> goals.

I must say that, although it's a bit shorter, I don't see a real advantage
to define some interface type xxx for

(1) typedef struct { ... } xxx;
    void f(xxx*);

and 

(2) struct xxx;
    void f(struct xxx*);

If you want to get rid of the "struct" in the interface you can go a bit
further:

(3) #ifndef xxx_t
    #define xxx_t struct xxx
    #endif
    void f(xxx_t*);

You can even go even farther and eliminate the '*' from interfaces:

(4) #ifndef xxx_t_defined
    #define xxx_t_defined
    typedef struct xxx* xxx_t;
    #endif
    void f(xxx_t);

Personally, I always use approach (2) and never had any problem, but this
may be biased by the fact that most of my own code is written in C++, so the
typedef is implicit and (2) is roughly equivalent to (1), but with the
advantage that xxx is an opaque type, something IMNSHO greatly compensate
for the need to add the "struct" keyword in C.

Regards,

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 

^ permalink raw reply	[flat|nested] 47+ messages in thread
* RE: Register group proposal
@ 2001-02-23  2:52 Bernard Dautrevaux
  2001-02-24 15:43 ` Nick Duffek
  0 siblings, 1 reply; 47+ messages in thread
From: Bernard Dautrevaux @ 2001-02-23  2:52 UTC (permalink / raw)
  To: 'Nick Duffek', ac131313; +Cc: gdb, insight

> -----Original Message-----
> From: Nick Duffek [ mailto:nsd@redhat.com ]
> Sent: Thursday, February 22, 2001 7:24 PM
> To: ac131313@cygnus.com
> Cc: gdb@sources.redhat.com; insight@sources.redhat.com
> Subject: Re: Register group proposal
> 
> 
> On 22-Feb-2001, Andrew Cagney wrote:
> 
> >And that illustrates the problem - why should "abc.h" suck in "xyz.h"
> >when clients of "abc.h" may not use any of "xyz"'s methods.
> 
> So that we may use typedefs in the standard and obvious manner.
> 
> What's the problem with "abc.h" sucking in "xyz.h"?  The 
> usual "#ifndef
> abc_h" envelope takes care of multiple-inclusion problems.

Perhaps for avoiding an unneeded dependency, that would trigger superfluous
recompiles of users of "abc.h" that do not need "xyz.h" if "xyz.h" is
modified? note that if your dependencies are kept up to date (something I
hope is true) you also end up with a lot bigger dependency lists, and thus
slower "make" processes, even if everything is already up-to-date ;-(

Another problem may be seen as "name space pollution": If you don't mind
about "xyz.h" why should you be prevented using some identifiers colliding
with the private parts of it?

As a rule of thumb, a header should only #include things it really NEEDS,
and try to avoid these as far as possible.

My 0.02$

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 

^ permalink raw reply	[flat|nested] 47+ messages in thread
* Re: Register group proposal
@ 2001-02-22  9:19 Michael Elizabeth Chastain
  0 siblings, 0 replies; 47+ messages in thread
From: Michael Elizabeth Chastain @ 2001-02-22  9:19 UTC (permalink / raw)
  To: ac131313, nsd; +Cc: gdb, insight

> Hmm, I think like MichaelC you may have missed the point.

No, actually, the point I missed was a different point.  :)

(Specifically, that a single opaque "typedef struct xyz xyz_t"
works properly, but having several identical lines like that in
one compilation unit isn't legal C).

Michael

^ permalink raw reply	[flat|nested] 47+ messages in thread
* Register group proposal
@ 2001-02-20 20:56 Nick Duffek
  2001-02-21  6:44 ` Fernando Nasser
                   ` (3 more replies)
  0 siblings, 4 replies; 47+ messages in thread
From: Nick Duffek @ 2001-02-20 20:56 UTC (permalink / raw)
  To: insight; +Cc: gdb, fnasser

On an architecture with a large register set, GDBtk's register window can
be difficult to read and slow to update.  Users can customize the window
to hide individual registers, but that's a tedious procedure.

Therefore, users would benefit from being able to switch easily between
register subsets.

The CLI already provides two register subsets:
  1. non-floating-point registers, displayed by "info registers";
  2. all registers, displayed by "info all-registers".

This grouping is not as useful as it could be, for various reasons:

  - Not all architectures have floating-point registers.

  - Many architectures have non-floating-point registers that, like
    floating-point registers, are only interesting to the user in special
    circumstances and that therefore waste limited screen space in most
    circumstances.

  - Some pseudo-registers might not be appropriate in either "info
    registers" or "info all-registers" output.  For example, if an
    architecture lacks a dedictated frame pointer register but its ABI
    stores the frame pointer in general register r31, then "fp" and "r31"
    might be aliases for the same register.  It would not be useful to
    display both fp and r31 in "info all-registers" output.

Whoever ports GDB to a particular architecture is likely to have a good
idea of what register groupings would be useful.

I propose the following gdbarch.sh macros with which architectures can
define register groupings:

  /* Return a null-terminated list of register group names.  */
  char **REGISTER_GROUPS (void)

  /* Return the REGISTER_GROUPS index of the group that "info registers"
     should display.  */
  int REGISTERS_SOME (void)

  /* Return the REGISTER_GROUPS index of the group that "info
     all-registers" should display.  */
  int REGISTERS_ALL (void)

The register cache would define these gdbarch.sh macros:

  /* Return the number of the first register to display in GROUP, which is
     an index in REGISTER_GROUPS.  */
  int REGISTER_INFO_FIRST (int group)

  /* Return the number of the register to display after register REGNUM
     in GROUP, which is an index in REGISTER_GROUPS.  If no registers
     should be displayed after register REGNUM, return -1.  */
  int REGISTER_INFO_NEXT (int group, int regnum)

GDBtk could use REGISTER_GROUPS to generate a menu of register windows.
Users could still customize window contents, but the predefined sets
might make customization unnecessary for most users.

The CLI "info registers" command already accepts a register name as an
optional paramter.  It could be extended to try that parameter as a group
name first and a register name second, so e.g. "info registers float"
would display all floating-point registers.

What do you think?

Nick

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2001-02-28  1:59 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-21  3:00 Register group proposal Stephane Carrez
2001-02-21  7:00 ` Nick Duffek
2001-02-21  9:34 ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2001-02-28  1:59 Bernard Dautrevaux
2001-02-26  5:29 Bernard Dautrevaux
2001-02-26  9:28 ` Christopher Faylor
2001-02-26 10:56   ` Andrew Cagney
2001-02-26 11:28     ` Christopher Faylor
2001-02-26 17:02       ` Andrew Cagney
2001-02-27  8:53         ` Christopher Faylor
2001-02-27  9:57           ` Andrew Cagney
2001-02-23  2:52 Bernard Dautrevaux
2001-02-24 15:43 ` Nick Duffek
2001-02-26 18:21   ` Andrew Cagney
2001-02-27 10:30     ` Jim Kleck
2001-02-27 11:24       ` Per Bothner
2001-02-27 13:44         ` Jim Kleck
2001-02-27 15:17           ` Andrew Cagney
2001-02-22  9:19 Michael Elizabeth Chastain
2001-02-20 20:56 Nick Duffek
2001-02-21  6:44 ` Fernando Nasser
2001-02-21  7:10   ` Nick Duffek
2001-02-21  7:36     ` Fernando Nasser
2001-02-21  7:58     ` Keith Seitz
2001-02-21  8:50 ` Andrew Cagney
2001-02-21 11:43   ` Andrew Cagney
2001-02-25 15:36   ` Nick Duffek
2001-02-21 11:43 ` Andrew Cagney
2001-02-21 12:28   ` Andrew Cagney
2001-02-21 12:18 ` Andrew Cagney
2001-02-22  0:59   ` Eli Zaretskii
2001-02-22  4:29     ` Nick Duffek
2001-02-22  8:46       ` Andrew Cagney
2001-02-22  8:56         ` Keith Seitz
2001-02-22  9:20           ` Andrew Cagney
2001-02-22  5:17   ` Nick Duffek
2001-02-22  6:36     ` Fernando Nasser
2001-02-22  8:23       ` Andrew Cagney
2001-02-22  7:58     ` Andrew Cagney
2001-02-22  8:37       ` Nick Duffek
2001-02-22  9:12         ` Andrew Cagney
2001-02-22 10:15           ` Nick Duffek
2001-02-22 10:25             ` Andrew Cagney
2001-02-22 11:40               ` Eli Zaretskii
2001-02-22 11:02           ` Kevin Buettner
2001-02-22 12:08             ` Andrew Cagney
2001-02-22  8:16     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).