Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@vnet.ibm.com>
To: Alan Modra <amodra@gmail.com>
Cc: Pedro Alves <palves@redhat.com>, Eli Zaretskii <eliz@gnu.org>,
	       nickc@redhat.com, gdb-patches@sourceware.org,
	uweigand@de.ibm.com,        binutils@sourceware.org
Subject: Re: [PATCH 1/2] Add support for setting disassembler-options in GDB for POWER, ARM and S390
Date: Tue, 24 Jan 2017 04:32:00 -0000	[thread overview]
Message-ID: <6962ef25-9722-f0f0-d0a2-209b10761311@vnet.ibm.com> (raw)
In-Reply-To: <20170124033625.GI28669@bubble.grove.modra.org>

On 1/23/17 9:36 PM, Alan Modra wrote:
> On Mon, Jan 23, 2017 at 08:39:25PM -0600, Peter Bergner wrote:
>> On 1/23/17 7:56 PM, Alan Modra wrote:
>>> On Mon, Jan 23, 2017 at 05:34:36PM -0600, Peter Bergner wrote:
>>>> The following S/390 specific disassembler options are supported for use\n\
>>>> with the -M switch (multiple options should be separated by commas):\n"));
>>>>
>>>> -  fprintf (stream, _("  esa         Disassemble in ESA architecture mode\n"));
>>>> -  fprintf (stream, _("  zarch       Disassemble in z/Architecture mode\n"));
>>>> -  fprintf (stream, _("  insnlength  Print unknown instructions according "
>>>> -		     "to length from first two bits\n"));
>>>> +  for (i = 0; sizeof (options) / sizeof (options[0]); i++)
>>>> +    {
>>>> +      unsigned int len = strlen (options[i].name);
>>>> +      if (max_len < len)
>>>> +	max_len = len;
>>>> +    }
>>>> +
>>>> +  for (i = 0, max_len++; sizeof (options) / sizeof (options[0]); i++)
>>>> +    fprintf (stream, "  %s%*c %s",
>>>> +	     options[i].name,
>>>> +	     (int)(max_len - strlen (options[i].name)), ' ',
>>>> +	     options[i].description);
>>>> }
>>>
>>> This appears to have lost translation of the help strings.
[snip]
> Yes, I meant the support for language translation.

Ok, I see now.  How about the following changes to to add _(...)
around the option descriptions for s390 and arm (ppc doesn't have any)?

Peter


diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 2987403..b5fd1e0 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
 get_arm_regnames (int option,
 		  const char **setname,
 		  const char **setdescription,
 		  const char *const **register_names)
 {
   *setname = regnames[option].name;
-  *setdescription = regnames[option].description;
+  *setdescription = _(regnames[option].description);
   *register_names = regnames[option].reg_names;
   return 16;
 }


@@ -6126,7 +6120,7 @@ arm_symbol_is_valid (asymbol * sym,
+const char **
+disassembler_options_desc_arm (void)
+{
+  static const char **desc = NULL;
+
+  if (desc == NULL)
+    {
+      size_t i;
+      size_t num_desc = NUM_ARM_REGNAMES + 2;
+      desc = XNEWVEC (const char *, num_desc + 1);
+      for (i = 0; i < NUM_ARM_REGNAMES; i++)
+	desc[i] = _(regnames[i].description);
+      desc[i++] = _("Assume all insns are Thumb insns");
+      desc[i++] = _("Examine preceding label to determine an insn's type");
+      desc[i] = NULL;
+    }
+
+  return desc;
+}
+



@@ -6855,7 +6889,7 @@ the -M switch:\n"));
     fprintf (stream, "  reg-names-%s %*c%s\n",
	     regnames[i].name,
	     (int)(14 - strlen (regnames[i].name)), ' ',
-	     regnames[i].description);
+	     _(regnames[i].description));

   fprintf (stream, "  force-thumb              Assume all insns are Thumb insns\n");
   fprintf (stream, "  no-force-thumb           Examine preceding label to determine an insn's type\n\n");


diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c
index 328ba2d..cbae7be 100644
--- a/opcodes/s390-dis.c
+++ b/opcodes/s390-dis.c
@@ -360,15 +369,58 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info *info)
+const char **
+disassembler_options_desc_s390 (void)
+{
+  static const char **desc = NULL;
+
+  if (desc == NULL)
+    {
+      size_t i, num_options = sizeof (options) / sizeof (options[0]);
+      desc = XNEWVEC (const char *, num_options + 1);
+      for (i = 0; i < num_options; i++)
+	desc[i] = _(options[i].description);
+      desc[i] = NULL;
+    }
+
+  return desc;
+}


+  for (i = 0, max_len++; sizeof (options) / sizeof (options[0]); i++)
+    fprintf (stream, "  %s%*c %s",
+	     options[i].name,
+	     (int)(max_len - strlen (options[i].name)), ' ',
+	     _(options[i].description));
 }



  reply	other threads:[~2017-01-24  4:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 19:19 Peter Bergner
2016-11-17 19:52 ` Peter Bergner
2016-11-18 10:25 ` Nick Clifton
2016-11-18 15:10   ` Peter Bergner
2016-11-18 15:38     ` Eli Zaretskii
2016-11-18 16:56       ` Peter Bergner
2016-11-18 17:08         ` Eli Zaretskii
2016-11-18 17:23         ` Pedro Alves
2016-11-22 17:04           ` Peter Bergner
2016-11-22 17:40             ` Pedro Alves
2017-01-23 23:35           ` Peter Bergner
2017-01-24  1:57             ` Alan Modra
2017-01-24  2:39               ` Peter Bergner
2017-01-24  3:36                 ` Alan Modra
2017-01-24  4:32                   ` Peter Bergner [this message]
2017-01-24 16:00                     ` Peter Bergner
2017-01-25  4:31                       ` Alan Modra
2017-01-25 17:20                         ` Peter Bergner
2017-01-24  3:29             ` Eli Zaretskii
     [not found]             ` <20170125142335.GT28060@E107787-LIN>
2017-01-25 14:30               ` Peter Bergner
2017-01-31 21:13               ` Peter Bergner
2017-02-01 21:44                 ` Yao Qi

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=6962ef25-9722-f0f0-d0a2-209b10761311@vnet.ibm.com \
    --to=bergner@vnet.ibm.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=palves@redhat.com \
    --cc=uweigand@de.ibm.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