Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: kevinb@redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] Add support for Morpho ms1 processor
Date: Fri, 10 Jun 2005 23:13:00 -0000	[thread overview]
Message-ID: <200506102312.j5ANCoWe018703@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <20050603172038.449a41b9@ironwood.lan> (message from Kevin Buettner on Fri, 3 Jun 2005 17:20:38 -0700)

   Date: Fri, 3 Jun 2005 17:20:38 -0700
   From: Kevin Buettner <kevinb@redhat.com>

   The patch below adds support for the Morpho Technologies ms1 processor
   to GDB.  This code was written by Michael Snyder.  (Though I and
   perhaps others have tweaked it here and there...)

   It's not quite ready to commit; there are still some bits at the top
   level, and in bfd/, opcodes/, and include/ that need to go in first. 
   Aldy Hernandez is submitting those portions.

   However, it occurs to me that there may be a few things in this GDB
   portion that ought to be adjusted before it goes in, so I'm posting it
   now for comments.

   So... comments?

There are a few coding-style violations, mostly regarding multi-line
comment style.  There is some excessive spacing too; the GNU coding
standards seem to suggest using ^L to seperate larger chunks of code,
not multiple lines of whitespace.  I also really would like to
encourage the usage of target-specific (ms1_) prefixes for function
and variable names.  Especially naming an enum `gdb_regnum' seems like
a bad idea to me.  What's the E_-prefix trying to convey?  I seem to
remember a few other embedded processors using the same E_-prefix for
their register names.  Internationalization of strings is missing too.

Can we somehow make sure this doesn't become yet another
commit-and-abondon target?

A few more comments down in the code.

   +
   +/* Function: register_name
   +   Returns the name of the standard ms1 register N.  */

Stating the function name in the comment here doesn't make sense.  The
GNU coding standards certainly don't suggest it.

   +static struct gdbarch *
   +ms1_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   +{
   +  struct gdbarch *gdbarch;
   +  static void ms1_frame_unwind_init (struct gdbarch *);
   +
   ...
   +  /* The MAC register for the MS1-16-003 is 8 bits larger
   +     than it is for the other machine variants.  */
   +  switch (info.bfd_arch_info->mach) {
   +  default:
   +  case bfd_mach_ms1:
   +    break;

This doesn't do anything...

   +
   +  set_gdbarch_register_name (gdbarch, ms1_register_name);
   +  set_gdbarch_num_regs      (gdbarch, E_NUM_REGS);
   +  set_gdbarch_num_pseudo_regs (gdbarch, E_NUM_PSEUDO_REGS);
   +  set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
   +  set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
   +  set_gdbarch_pseudo_register_read  (gdbarch, ms1_pseudo_register_read);
   +  set_gdbarch_pseudo_register_write (gdbarch, ms1_pseudo_register_write);
   +  set_gdbarch_skip_prologue (gdbarch, ms1_skip_prologue);
   +  set_gdbarch_inner_than    (gdbarch, core_addr_lessthan);
   +  set_gdbarch_breakpoint_from_pc    (gdbarch, ms1_breakpoint_from_pc);
   +  set_gdbarch_decr_pc_after_break   (gdbarch, 0);
   +  set_gdbarch_frame_args_skip (gdbarch, 0);
   +  set_gdbarch_print_insn      (gdbarch, print_insn_ms1);
   +  set_gdbarch_register_type   (gdbarch, ms1_register_type);
   +  set_gdbarch_register_reggroup_p (gdbarch, ms1_register_reggroup_p);

Don't try to line things up here; there should only be a single space.

   +   * Target builtin data types.
   +   */
   +  set_gdbarch_short_bit       (gdbarch, 2 * TARGET_CHAR_BIT);
   +  set_gdbarch_int_bit         (gdbarch, 4 * TARGET_CHAR_BIT);
   +  set_gdbarch_long_bit        (gdbarch, 4 * TARGET_CHAR_BIT);
   +  set_gdbarch_long_long_bit   (gdbarch, 8 * TARGET_CHAR_BIT);
   +  set_gdbarch_float_bit       (gdbarch, 4 * TARGET_CHAR_BIT);
   +  set_gdbarch_double_bit      (gdbarch, 8 * TARGET_CHAR_BIT);
   +  set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
   +  set_gdbarch_ptr_bit         (gdbarch, 4 * TARGET_CHAR_BIT);

Personally I think this TARGET_CHAR_BIT is really silly, as if we're
going to support something other than 8.  I really thing hardcoding
the numbers is much clearer.  A `short' is 16 bits, not 2 times some
arbitrary constant.

   +
   +static void
   +ms1_frame_unwind_init (struct gdbarch *gdbarch)
   +{
   +  /* This is the keystone.  You add your "sniffer" to a 
   +     sniffer list, and now you're in the game.  This registers
   +     a) the sniffer, b) the 'prev_register', and c) the 'this_id'
   +     methods.
   +  */

That last */ defenitely shouldn't sit alone on a line.

Mark


  parent reply	other threads:[~2005-06-10 23:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-04  0:21 Kevin Buettner
2005-06-04  0:40 ` Daniel Jacobowitz
2005-06-10 23:13 ` Mark Kettenis [this message]
2005-06-11  1:40   ` Michael Snyder
2005-06-11  1:57   ` Daniel Jacobowitz
2005-08-12  0:04     ` Kevin Buettner
2005-08-15 22:33       ` Kevin Buettner
2005-08-11 23:58 ` Kevin Buettner
2005-08-12  9:43   ` Eli Zaretskii
2005-08-15 22:27     ` Kevin Buettner
2005-08-16 17:23       ` Eli Zaretskii
2005-08-17 23:13         ` Kevin Buettner
2005-08-12 11:51   ` Mark Kettenis
2005-08-12 20:52     ` Kevin Buettner
2005-08-12 20:57       ` Mark Kettenis
2005-08-15 22:03 ` Kevin Buettner

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=200506102312.j5ANCoWe018703@elgar.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.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