Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Kaushik Phatak <Kaushik.Phatak@kpitcummins.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA 3/5] New port: CR16: gdb port
Date: Mon, 08 Oct 2012 06:59:00 -0000	[thread overview]
Message-ID: <507279C7.8080401@codesourcery.com> (raw)
In-Reply-To: <C6CA53A2A46BA7469348BDBD663AB65845B2FF80@KCHJEXMB03.kpit.com>

On 10/04/2012 06:20 PM, Kaushik Phatak wrote:

Hi, Kaushik,
I don't read your patch in details yet, just some small points I found...

> +const gdb_byte breakpoint_uclinux[] = { 0xC7, 0x00 };

Add 'static'.  It is not used out of this file.

> +/* Allocate and initialize a gdbarch object.  */
> +static struct gdbarch *
> +cr16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
> +{
> +  struct gdbarch *gdbarch;
> +  struct gdbarch_tdep *tdep;
> +  int elf_flags;
> +
> +  /* Extract the elf_flags if available.  */
> +  if (info.abfd != NULL
> +      && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
> +    elf_flags = elf_elfheader (info.abfd)->e_flags;
> +  else
> +    elf_flags = 0;
> +
> +  /* Try to find the architecture in the list of already defined
> +     architectures.  */
> +  for (arches = gdbarch_list_lookup_by_info (arches, &info);
> +       arches != NULL;
> +       arches = gdbarch_list_lookup_by_info (arches->next, &info))
> +    {
> +      if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
> +	continue;
> +
> +      return arches->gdbarch;
> +    }
> +  /* None found, create a new architecture from the information
> +     provided.  */
> +  tdep = (struct gdbarch_tdep *) xcalloc (1,sizeof (struct gdbarch_tdep));
> +  tdep->elf_flags = elf_flags;
> +  gdbarch = gdbarch_alloc (&info, tdep);
> +
> +  set_gdbarch_num_pseudo_regs (gdbarch, 0);
> +  if(info.osabi == GDB_OSABI_LINUX)
> +  {
> +    set_gdbarch_num_regs (gdbarch, CR16_LINUX_NUM_REGS);
> +    set_gdbarch_register_name (gdbarch, cr16_linux_register_name);

This part should be moved to function cr16_uclinux_init_abi, and then 
macro CR16_LINUX_NUM_REGS can be defined in cr16-linux-tdep.c instead of 
cr16-tdep.h.

> +  }
> +  else
> +  {
> +    set_gdbarch_num_regs (gdbarch, CR16_NUM_REGS);
> +    set_gdbarch_register_name (gdbarch, cr16_register_name);
> +  }

> --- ./gdb_src.orig/gdb/cr16-tdep.h	1970-01-01 05:30:00.000000000 +0530
> +++ ./gdb_src/gdb/cr16-tdep.h	2012-09-04 13:05:39.000000000 +0530
> @@ -0,0 +1,36 @@
> +/* GNU/Linux on  CR16 target support.
> +   Copyright (C) 2011-2012 Free Software Foundation, Inc.
> +
> +   Contributed by Kaushik Phatak (kaushik.pahatk@kpitcummins.com)
> +   KPIT Cummins Infosystems Limited, Pune India.
> +
> +   This file is part of GDB.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
> +
> +#define CR16_NUM_REGS  22
> +#define CR16_LINUX_NUM_REGS  21

These two macros can be defined in cr16-tdep.c and cr16-linux-tdep.c 
respectively.

> +
> +extern const gdb_byte breakpoint_elf[];
> +extern const gdb_byte breakpoint_linux[];

They are not needed.  'breakpoint_elf' is only used in cr16-tdep.c, and 
'breakpoint_linux' doesn't exist at all.

-- 
Yao


  parent reply	other threads:[~2012-10-08  6:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04 10:22 Kaushik Phatak
2012-10-04 14:48 ` Joel Brobecker
2012-10-05 11:44   ` Kaushik Phatak
2012-10-05 12:21     ` Joel Brobecker
2012-10-09 13:20       ` Kaushik Phatak
2012-10-08  6:59 ` Yao Qi [this message]
2012-10-09 15:03   ` Kaushik Phatak
2012-10-22 22:41     ` Joel Brobecker
2012-10-23 13:03       ` Kaushik Phatak
2012-10-23 13:55         ` Joel Brobecker
2012-10-26  5:15           ` Kaushik Phatak
2012-11-15 17:43             ` Joel Brobecker
2012-11-20 13:01               ` Kaushik Phatak
2012-11-22 17:50                 ` Joel Brobecker
2013-01-08 10:02                   ` Kaushik Phatak
2013-01-15  9:31                   ` Kaushik Phatak
2013-01-17  8:59                     ` Joel Brobecker
2013-01-18  7:41                       ` Kaushik Phatak
2013-01-18 14:17                         ` Joel Brobecker
2013-01-22 13:49                           ` Kaushik Phatak
2013-01-22 15:43                             ` Pedro Alves
2013-01-23 14:22                               ` Kaushik Phatak
2013-01-23 14:26                                 ` Pedro Alves
2013-01-23 15:34                                 ` Pedro Alves
2013-06-19 13:30                                   ` Kaushik Phatak
2013-06-25 18:42                                     ` Pedro Alves
2013-06-26  7:08                                       ` Kaushik Phatak
2013-06-26 10:37                                         ` Pedro Alves
2013-01-18 18:25                       ` Pedro Alves

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=507279C7.8080401@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=Kaushik.Phatak@kpitcummins.com \
    --cc=gdb-patches@sourceware.org \
    /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