Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: mludvig@suse.cz
Cc: drow@mvista.com, gdb-patches@sources.redhat.com, ac131313@redhat.com
Subject: Re: [RFA] New bitflags type and eflags on i386/x86-64
Date: Fri, 06 Sep 2002 13:01:00 -0000	[thread overview]
Message-ID: <200209061959.g86JxhK0000467@elgar.kettenis.dyndns.org> (raw)
In-Reply-To: <3D770FFB.5030802@suse.cz> (message from Michal Ludvig on Thu, 05 Sep 2002 10:04:11 +0200)

   Date: Thu, 05 Sep 2002 10:04:11 +0200
   From: Michal Ludvig <mludvig@suse.cz>

   Daniel Jacobowitz wrote:
   > On Tue, Sep 03, 2002 at 11:17:43AM +0200, Michal Ludvig wrote:
   >>Thanks for help. Attached file incorporates your patch as well. Could 
   >>anyone approve it, please?
   > 
   > Can't approve it, but I like it.  Thanks for following this through.

   Who can approve? Andrew? MarkK? Someone else?

Well, I'm not too happy about the introduction of i386-common-tdep.c.
I mean, those functions belong in i386-tdep.c.  Can we postpone
integrating this patch until I've unified the i386 and x86-64 targets
into one truly multi-arched one?  I've started working on that now,
honestly :-).

Anyway, before approving this I'd like to see a bit more consensus
about the BitFlags type your patch introduces.  Andrew, is it OK with
you now?

There also some coding-style problems with your code:

Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.56
diff -u -p -r1.56 gdbtypes.c
--- gdbtypes.c	20 Aug 2002 19:57:32 -0000	1.56
+++ gdbtypes.c	30 Aug 2002 13:42:50 -0000
@@ -782,6 +782,61 @@ create_set_type (struct type *result_typ
   return (result_type);
 }
 
+/*
+ * - The following three functions are intended to be used for BitFlags 
+ *   types (e.g. i386's EFLAGS register).
+ * - A BitFlags type is an integer where bits may have a symbolic name 
+ *   to be printed when the bit is set.
+ * - Printing is done in <lang>_val_print() under a TYPE_CODE_FLAGS label.
+ * - Add symbolic names for relevant bits using add_flag_name() after
+ *   initializing the BitFlags type.
+ */

That's not the right comment style.

+void
+add_flag_ignore (struct type *type, int bitpos)
+{
+	TYPE_FIELD_BITPOS (type, bitpos) = -1;
+}

Indentation is wrong here...

+void
+add_flag_name (struct type *type, int bitpos, char *name)
+{
+	int namelen;
+	
+	gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLAGS);
+	gdb_assert (bitpos < TYPE_NFIELDS (type));
+	gdb_assert (bitpos >= 0);
+	
+	namelen=strlen(name)+1;
+	TYPE_FIELD_NAME (type, bitpos) = xmalloc (namelen);
+	snprintf(TYPE_FIELD_NAME (type, bitpos), namelen, "%s", name);	
+
+	TYPE_FIELD_BITPOS (type, bitpos) = bitpos;
+}

...and here.

+struct type *
+init_flags_type (int bitlength, char *name, struct objfile *objfile)
+{
+  register struct type *type;

We're trying to get rid of "register".

Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.35
diff -u -p -r1.35 gdbtypes.h
--- gdbtypes.h	10 Aug 2002 05:12:40 -0000	1.35
+++ gdbtypes.h	30 Aug 2002 13:42:51 -0000
@@ -1054,6 +1056,14 @@ extern struct type *alloc_type (struct o
 
 extern struct type *init_type (enum type_code, int, int, char *,
 			       struct objfile *);
+
+/* Helper functions to construct BitField type.  
+   See description in gdbarch.c for details.  */

Are you sure this reference to gdbarch.c is still correct?

Mark


  reply	other threads:[~2002-09-06 20:01 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-22  8:35 Michal Ludvig
2002-08-27 14:50 ` Andrew Cagney
2002-08-28  7:48   ` Michal Ludvig
2002-08-28  8:08     ` Daniel Jacobowitz
2002-08-28  8:09       ` Michal Ludvig
2002-08-28 10:03       ` Andrew Cagney
2002-08-29  7:20   ` Michal Ludvig
2002-08-29  7:57     ` Daniel Jacobowitz
2002-08-29  8:03       ` Michal Ludvig
2002-08-29  8:15         ` Daniel Jacobowitz
2002-08-29  8:59           ` Andrew Cagney
2002-08-29 16:37             ` Mark Kettenis
2002-08-30  7:09               ` Michal Ludvig
2002-08-30  7:05             ` Michal Ludvig
2002-08-30  7:12               ` Pierre Muller
2002-08-30  7:41                 ` Michal Ludvig
2002-08-30  8:14                   ` Daniel Jacobowitz
2002-08-30 10:18                     ` Pierre Muller
2002-09-03  2:17                       ` Michal Ludvig
2002-09-03  5:30                         ` Daniel Jacobowitz
2002-09-05  1:04                           ` Michal Ludvig
2002-09-06 13:01                             ` Mark Kettenis [this message]
2002-09-09 20:35                               ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2002-04-22  8:15 Michal Ludvig
2002-04-22  8:45 ` Daniel Jacobowitz
2002-04-22  9:08   ` Michal Ludvig
2002-04-22 19:05     ` Andrew Cagney
2002-04-22 21:28     ` Daniel Jacobowitz
2002-04-23  6:22       ` Michal Ludvig
2002-04-23  7:32         ` Daniel Jacobowitz
2002-04-29  9:54   ` Pierre Muller
2002-04-29 10:11     ` Michal Ludvig
2002-04-29 10:17     ` Daniel Jacobowitz

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=200209061959.g86JxhK0000467@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=ac131313@redhat.com \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mludvig@suse.cz \
    /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