Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Shahab Vahedi <shahab.vahedi@gmail.com>, gdb-patches@sourceware.org
Cc: Shahab Vahedi <shahab@synopsys.com>,
	Anton Kolesov <Anton.Kolesov@synopsys.com>,
	Tom Tromey <tom@tromey.com>,
	Francois Bedard <fbedard@synopsys.com>
Subject: Re: [PATCH v2 1/4] arc: Add XML target features for Linux targets
Date: Thu, 14 May 2020 10:49:04 -0400	[thread overview]
Message-ID: <abceccb2-9d1c-5ee9-0187-23a2aa324680@simark.ca> (raw)
In-Reply-To: <20200428160437.1585-2-shahab.vahedi@gmail.com>

On 2020-04-28 12:04 p.m., Shahab Vahedi via Gdb-patches wrote:
> From: Anton Kolesov <Anton.Kolesov@synopsys.com>
> 
> Add XML target features for Linux targets.  Compared to default
> Linux features:
> 
> - Explicitly specify CPU machine.
> - Remove baremetal only ILINK{,1,2} registers.
> - Add LP_START and LP_END registers for hardware loops - required to
>   properly evaluate possible next instruction during software single
>   instruction stepping.
> - Add BTA register which contains branch target address - address of
>   next instruction when processor is in the delay slot.
> - ARC HS description also adds R30, R58 and R59 registers, specific to
>   this architecture.
> 
> gdb/ChangeLog:
> 2020-04-28  Anton Kolesov  <anton.kolesov@synopsys.com>
> 
> 	* arch/arc.h (arc_create_target_description): Support Linux targets.
> 	* arch/arc.c (arc_create_target_description): Likewise.
> 	* arc-tdep.c (arc_tdesc_init): Update invocation of
> 	  arc_read_description.
> 	* features/Makefile (FEATURE_XMLFILES): Add new files.
> 	* features/arc/aux-arcompact-linux.xml: New file.
> 	* features/arc/aux-v2-linux.xml: Likewise.
> 	* features/arc/core-arcompact-linux.xml: Likewise.
> 	* features/arc/core-v2-linux.xml: Likewise.
> 	* features/arc/aux-arcompact-linux.c: Generate.
> 	* features/arc/aux-v2-linux.c: Likewise.
> 	* features/arc/core-arcompact-linux.c: Likewise.
> 	* features/arc/core-v2-linux.c: Likewise.

Hi Shahab,

Instead of having multiple almost identical features, it's now usual
to build small features and compose them into the full target description.

For example, instead of having both:

- core-arcompact.xml
- core-arcompact-linux.xml

I think you should have:

- core-arcompact.xml, containing everything that's common in the two above
- core-arcompact-baremetal.xml, containing only the registers that are only present
  in the baremetal version.

When building the target description, the pseudo code would look like:

  if (arcompact)
    create_core_arcompact_feature ();
  else
    create_core_v2_feature ();

  if (baremetal) // or if (!linux)
    {
      if (arcompact)
        create_core_arccompact_baremetal_feature ();
      else
        create_core_v2_baremetal_feature ();
    }

Same goes for aux.  The i386 and arm target descriptions have examples of how to do
that.

Note that I don't know if the order of the registers in the target description
matters...  if so it could make this more difficult.

> @@ -37,21 +41,39 @@ arc_create_target_description (arc_sys_type sys_type)
>    long regnum = 0;
>  
>  #ifndef IN_PROCESS_AGENT
> -  if (sys_type == ARC_SYS_TYPE_ARCV2)
> +  if (sys_type == ARC_SYS_TYPE_ARCV2_BMT)
>      set_tdesc_architecture (tdesc, "arc:ARCv2");
> +  else if (sys_type == ARC_SYS_TYPE_ARCV2_LNX)
> +    /* If this is ARCv2 Linux, then it is ARC HS.  */
> +    set_tdesc_architecture (tdesc, "arc:HS");
>    else
>      set_tdesc_architecture (tdesc, "arc:ARC700");
> +
> +  if (sys_type == ARC_SYS_TYPE_ARCOMPACT_LNX
> +      || sys_type == ARC_SYS_TYPE_ARCV2_LNX)
> +    set_tdesc_osabi (tdesc, "GNU/Linux");
>  #endif
>  
> -  if (sys_type == ARC_SYS_TYPE_ARCV2)
> -    {
> -      regnum = create_feature_arc_core_v2 (tdesc, regnum);
> -      regnum = create_feature_arc_aux_v2 (tdesc, regnum);
> -    }
> -  else
> +  switch (sys_type)
>      {
> -      regnum = create_feature_arc_core_arcompact (tdesc, regnum);
> -      regnum = create_feature_arc_aux_arcompact (tdesc, regnum);
> +    case ARC_SYS_TYPE_ARCOMPACT_BMT:
> +	  regnum = create_feature_arc_core_arcompact (tdesc, regnum);
> +	  regnum = create_feature_arc_aux_arcompact (tdesc, regnum);
> +	  break;
> +    case ARC_SYS_TYPE_ARCOMPACT_LNX:
> +	  regnum = create_feature_arc_core_arcompact_linux (tdesc, regnum);
> +	  regnum = create_feature_arc_aux_arcompact_linux (tdesc, regnum);
> +	  break;
> +    case ARC_SYS_TYPE_ARCV2_BMT:
> +	  regnum = create_feature_arc_core_v2 (tdesc, regnum);
> +	  regnum = create_feature_arc_aux_v2 (tdesc, regnum);
> +	  break;
> +    case ARC_SYS_TYPE_ARCV2_LNX:
> +	  regnum = create_feature_arc_core_v2_linux (tdesc, regnum);
> +	  regnum = create_feature_arc_aux_v2_linux (tdesc, regnum);
> +	  break;
> +    default:
> +	  gdb_assert(!"Invalid arc_sys_type.");
>      }

The goal of having descriptions built at runtime with features is to avoid
this kind of combinatorial explosion.  Now, you have two axis of configuration
(arcompact vs arcv2, bare-metal vs linux).  If you had more, it would become
less and less practical.  That's why I would encourage you to consider what I
said above.

>  
>    return tdesc;
> diff --git a/gdb/arch/arc.h b/gdb/arch/arc.h
> index fd806ae7d34..3c19118b946 100644
> --- a/gdb/arch/arc.h
> +++ b/gdb/arch/arc.h
> @@ -23,8 +23,10 @@
>  /* Supported ARC system hardware types.  */
>  enum arc_sys_type
>  {
> -  ARC_SYS_TYPE_ARCOMPACT = 0,	  /* ARC600 or ARC700 */
> -  ARC_SYS_TYPE_ARCV2,		  /* ARC EM or ARC HS */
> +  ARC_SYS_TYPE_ARCOMPACT_BMT = 0, /* ARC600 or ARC700 (baremetal) */
> +  ARC_SYS_TYPE_ARCOMPACT_LNX,	  /* ARC600 or ARC700 (linux) */
> +  ARC_SYS_TYPE_ARCV2_BMT,	  /* ARC EM or ARC HS (baremetal) */
> +  ARC_SYS_TYPE_ARCV2_LNX,	  /* ARC HS (linux) */
>    ARC_SYS_TYPE_NUM

That's also not expected.  The fact that the target system is running Linux
should be handled by the fact that the selected osabi will be Linux.  So
you shouldn't need any changes here.

Simon


  reply	other threads:[~2020-05-14 14:49 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 12:52 [PATCH 0/4] arc: Add GNU/Linux support Shahab Vahedi
2020-03-26 12:52 ` [PATCH 1/4] arc: Add XML target features for Linux targets Shahab Vahedi
2020-04-24 13:46   ` Tom Tromey
2020-03-26 12:52 ` [PATCH 2/4] arc: Recognize registers available on " Shahab Vahedi
2020-04-24 13:50   ` Tom Tromey
2020-03-26 12:52 ` [PATCH 3/4] arc: Add GNU/Linux support for ARC Shahab Vahedi
2020-04-24 14:00   ` Tom Tromey
2020-03-26 12:52 ` [PATCH 4/4] arc: Add arc-*-linux regformats Shahab Vahedi
2020-04-24 14:01   ` Tom Tromey
2020-04-06  9:13 ` [PING][PATCH 0/4] arc: Add GNU/Linux support Shahab Vahedi
2020-04-20 16:51 ` [PING^2][PATCH " Shahab Vahedi
2020-04-28 16:04 ` [PATCH v2 " Shahab Vahedi
2020-04-28 16:04   ` [PATCH v2 1/4] arc: Add XML target features for Linux targets Shahab Vahedi
2020-05-14 14:49     ` Simon Marchi [this message]
2020-04-28 16:04   ` [PATCH v2 2/4] arc: Recognize registers available on " Shahab Vahedi
2020-04-28 16:56     ` Eli Zaretskii
2020-05-14 15:01     ` Simon Marchi
2020-06-17 15:46       ` Shahab Vahedi
2020-07-13 15:48         ` Simon Marchi
2020-07-14  9:05           ` Shahab Vahedi
2020-04-28 16:04   ` [PATCH v2 3/4] arc: Add GNU/Linux support for ARC Shahab Vahedi
2020-05-14 15:09     ` Simon Marchi
2020-06-15 23:13       ` Shahab Vahedi
2020-06-16  0:58         ` Simon Marchi
2020-04-28 16:04   ` [PATCH v2 4/4] arc: Add arc-*-linux regformats Shahab Vahedi
2020-05-14 15:12     ` Simon Marchi
2020-06-15 23:37       ` Shahab Vahedi
2020-06-16  2:08         ` Simon Marchi
2020-05-14 11:43   ` [PATCH v2 0/4] arc: Add GNU/Linux support Shahab Vahedi
2020-07-13 15:45   ` [PATCH v3 0/3] " Shahab Vahedi
2020-07-13 15:45     ` [PATCH v3 1/3] arc: Add ARCv2 XML target along with refactoring Shahab Vahedi
2020-07-15  2:52       ` Simon Marchi
2020-07-15 20:35         ` Shahab Vahedi
2020-07-15 21:23           ` Christian Biesinger
2020-07-16  1:59             ` Simon Marchi
2020-07-16 13:28           ` Simon Marchi
2020-07-22 13:36             ` Shahab Vahedi
2020-07-22 13:49               ` Simon Marchi
2020-07-22 14:33                 ` Shahab Vahedi
2020-07-22 14:54                   ` Simon Marchi
2020-07-13 15:45     ` [PATCH v3 2/3] arc: Add hardware loop detection Shahab Vahedi
2020-07-15  2:55       ` Simon Marchi
2020-07-13 15:45     ` [PATCH v3 3/3] arc: Add GNU/Linux support for ARC Shahab Vahedi
2020-07-15  3:03       ` Simon Marchi
2020-07-23 19:35     ` [PATCH v4 0/3] arc: Add GNU/Linux support Shahab Vahedi
2020-07-23 19:35       ` [PATCH v4 1/3] arc: Add ARCv2 XML target along with refactoring Shahab Vahedi
2020-07-30 23:34         ` Simon Marchi
2020-07-23 19:35       ` [PATCH v4 2/3] arc: Add hardware loop detection Shahab Vahedi
2020-08-01 14:53         ` Simon Marchi
2020-07-23 19:35       ` [PATCH v4 3/3] arc: Add GNU/Linux support for ARC Shahab Vahedi
2020-08-01 15:01         ` Simon Marchi
2020-08-01 23:31       ` [PATCH v4 0/3] arc: Add GNU/Linux support Simon Marchi
2020-08-04  7:59         ` Shahab Vahedi
2020-08-04 12:42           ` Simon Marchi
2020-08-04  8:57 ` [PATCH v5 0/4] " Shahab Vahedi
2020-08-04  8:57   ` [PATCH v5 1/4] arc: Add ARCv2 XML target along with refactoring Shahab Vahedi
2020-08-04 13:08     ` Simon Marchi
2020-08-04 13:18       ` Shahab Vahedi
2020-08-04 13:20         ` Simon Marchi
2020-08-04 14:12           ` Shahab Vahedi
2020-08-04  8:57   ` [PATCH v5 2/4] arc: Add inclusion of "gdbarch.h" in "arc-tdep.h" Shahab Vahedi
2020-08-04  8:57   ` [PATCH v5 3/4] arc: Add hardware loop detection Shahab Vahedi
2020-08-04 14:28     ` Eli Zaretskii
2020-08-04 16:17       ` Shahab Vahedi
2020-08-04 16:42         ` Eli Zaretskii
2020-08-04 18:15           ` Shahab Vahedi
2020-08-04  8:57   ` [PATCH v5 4/4] arc: Add GNU/Linux support for ARC Shahab Vahedi
2020-08-04 12:49   ` [PATCH v5 0/4] arc: Add GNU/Linux support Simon Marchi
2020-08-04 13:05     ` Shahab Vahedi
2020-08-05 11:09 ` [PATCH v6 " Shahab Vahedi
2020-08-05 11:09   ` [PATCH v6 1/4] arc: Add ARCv2 XML target along with refactoring Shahab Vahedi
2020-08-05 14:31     ` Eli Zaretskii
2020-08-21 16:16     ` Simon Marchi
2020-08-24 20:14       ` Shahab Vahedi
2020-08-05 11:09   ` [PATCH v6 2/4] arc: Add inclusion of "gdbarch.h" in "arc-tdep.h" Shahab Vahedi
2020-08-05 11:09   ` [PATCH v6 3/4] arc: Add hardware loop detection Shahab Vahedi
2020-08-05 11:09   ` [PATCH v6 4/4] arc: Add GNU/Linux support for ARC Shahab Vahedi
2020-08-17  8:07   ` [PATCH v6 0/4] arc: Add GNU/Linux support Shahab Vahedi
2020-08-17 14:12     ` Eli Zaretskii
2020-08-25 15:47 ` [PUSHED " Shahab Vahedi
2020-08-25 15:47   ` [PUSHED 1/4] arc: Add ARCv2 XML target along with refactoring Shahab Vahedi
2020-08-25 16:00     ` Eli Zaretskii
2020-08-25 15:47   ` [PUSHED 2/4] arc: Add inclusion of "gdbarch.h" in "arc-tdep.h" Shahab Vahedi
2020-08-25 15:47   ` [PUSHED 3/4] arc: Add hardware loop detection Shahab Vahedi
2020-08-25 15:58     ` Eli Zaretskii
2020-08-25 15:47   ` [PUSHED 4/4] arc: Add GNU/Linux support for ARC Shahab Vahedi

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=abceccb2-9d1c-5ee9-0187-23a2aa324680@simark.ca \
    --to=simark@simark.ca \
    --cc=Anton.Kolesov@synopsys.com \
    --cc=fbedard@synopsys.com \
    --cc=gdb-patches@sourceware.org \
    --cc=shahab.vahedi@gmail.com \
    --cc=shahab@synopsys.com \
    --cc=tom@tromey.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