Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Walfred Tedeschi <walfred.tedeschi@intel.com>,
	eliz@gnu.org,        qiyaoltc@gmail.com, brobecker@adacore.com
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v9] amd64-mpx: initialize BND register before performing inferior calls.
Date: Tue, 07 Mar 2017 11:18:00 -0000	[thread overview]
Message-ID: <8a64b4d9-dde5-32fa-2c71-836ed87f3640@redhat.com> (raw)
In-Reply-To: <1488215745-5625-1-git-send-email-walfred.tedeschi@intel.com>

Hi Walfred,

>    /* Determine the total space required for arguments and struct
>       return address in a first pass (allowing for 16-byte-aligned
>       arguments), then push arguments in a second pass.  */
> diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
> index c986e39..4ce1208 100644
> --- a/gdb/i387-tdep.c
> +++ b/gdb/i387-tdep.c
> @@ -1860,3 +1860,20 @@ i387_return_value (struct gdbarch *gdbarch, struct regcache *regcache)
>    regcache_raw_write_unsigned (regcache, I387_FTAG_REGNUM (tdep), 0x3fff);
>  
>  }
> +
> +  /* See i387-tdep.h.  */

Please fix indentation here.

> +
> +void
> +i387_reset_bnd_regs (struct gdbarch *gdbarch, struct regcache *regcache)
> +{

In the test:

> +
> +int
> +lower (int *a, int *b, int *c, int *d, int len)
> +{
> +  int value;
> +
> +  value = *(a - len);
> +  value = *(b - len);
> +  value = *(c - len);
> +  value = *(d - len);
> +
> +

Spurious double empty line.

> +  value = value - *a + 1;
> +  return value;
> +}
> +
> +
> +char
> +char_upper (char *str, int lenght)
> +{
> +  char ch;
> +  ch = *(str + lenght);

More "lenght" typos.  Please do a global search/replace in the patch.

> +
> +  return ch;
> +}
> +


> +int
> +main (void)
> +{
> +  if (have_mpx ())
> +    {
> +      int sa[ARRAY_LENGTH];
> +      int sb[ARRAY_LENGTH];
> +      int sc[ARRAY_LENGTH];
> +      int sd[ARRAY_LENGTH];
> +      int *x, *a, *b, *c, *d;
> +      char mchar;
> +      char hello[] = "Hello";
> +
> +      x = malloc (sizeof (int) * ARRAY_LENGTH);
> +      a = malloc (sizeof (int) * ARRAY_LENGTH);
> +      b = malloc (sizeof (int) * ARRAY_LENGTH);
> +      c = malloc (sizeof (int) * ARRAY_LENGTH);
> +      d = malloc (sizeof (int) * ARRAY_LENGTH);
> +
> +      *x = upper (sa, sb, sc, sd, 0);  /* bkpt 1.  */
> +      *x = lower (a, b, c, d, 0);  /* bkpt 1.  */

Two lines with "bkpt 1" doesn't look right.  The second one should
probably be removed.

> +
> +      mchar = char_upper (hello, 10);
> +      mchar = char_lower (hello, 10);
> +
> +      free (x);
> +      free (a);
> +      free (b);
> +      free (c);
> +      free (d);
> +    }
> +  return 0; /* bkpt 3.  */

This "bkpt 3" marker isn't used anywhere AFAICS.  Remove it.

> +}


> +gdb_test_multiple "print have_mpx ()" "have mpx" {
                                          ^^^^^^^^

This ...

> +    -re ".*= 1\r\n$gdb_prompt " {
> +        pass "check whether processor supports MPX"
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

... and this test message are inconsistent.  See below.

> +    }
> +    -re ".*= 0\r\n$gdb_prompt " {
> +        untested "processor does not support MPX; skipping tests"
> +        return
> +    }
> +}
> +

Write:

set test "check whether processor supports MPX"
gdb_test_multiple "print have_mpx ()" $test {
    -re ".*= 1\r\n$gdb_prompt " {
        pass $test
    }
    -re ".*= 0\r\n$gdb_prompt " {
        pass $test
        untested "processor does not support MPX; skipping tests"
        return
    }
}

OK with those changes.

Thanks,
Pedro Alves


  reply	other threads:[~2017-03-07 11:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 17:16 Walfred Tedeschi
2017-03-07 11:18 ` Pedro Alves [this message]
2017-03-07 12:38   ` Tedeschi, Walfred
2017-03-08 11:11 ` Jiong Wang
2017-03-08 12:02   ` Tedeschi, Walfred

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=8a64b4d9-dde5-32fa-2c71-836ed87f3640@redhat.com \
    --to=palves@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    --cc=walfred.tedeschi@intel.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