Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Michael Sturm <michael.sturm@intel.com>,
	mark.kettenis@xs4all.nl,        eliz@gnu.org
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3 5/5] Add support for Intel PKRU register to GDB and GDBserver.
Date: Thu, 26 Jan 2017 15:38:00 -0000	[thread overview]
Message-ID: <c160cf95-ddf6-2c62-963b-588558f6c1d2@redhat.com> (raw)
In-Reply-To: <1481021894-29471-6-git-send-email-michael.sturm@intel.com>

On 12/06/2016 10:58 AM, Michael Sturm wrote:

> diff --git a/gdb/features/i386/32bit-pkeys.xml b/gdb/features/i386/32bit-pkeys.xml
> new file mode 100644
> index 0000000..84fff51
> --- /dev/null
> +++ b/gdb/features/i386/32bit-pkeys.xml
> @@ -0,0 +1,13 @@
> +<?xml version="1.0"?>
> +<!-- Copyright (C) 2015-2016 Free Software Foundation, Inc.

2017.

> +

> +/* PKRU register?  */
> +
> +int
> +i386_pkru_regnum_p (struct gdbarch *gdbarch, int regnum)

We should start using bool.

> +{
> +  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> +  int pkru_regnum = tdep->pkru_regnum;
> +
> +  if (pkru_regnum < 0)
> +    return 0;

return false;

> +
> +  regnum -= pkru_regnum;
> +  return regnum >= 0 && regnum < I387_NUM_PKEYS_REGS;
> +}
> +


> +   Copyright 2015-2016 Free Software Foundation, Inc.
> +
> +   Contributed by Intel Corp. <michael.sturm@intel.com>

Please see:

  https://sourceware.org/gdb/wiki/ContributionChecklist#Attribution


In the test:

> +#include <stdio.h>

This is not needed, right?

> +#include "x86-cpuid.h"



> +# Read values from pseudo registers.
> +gdb_breakpoint [ gdb_get_line_number "break here 1" ]
> +gdb_continue_to_breakpoint "break here 1" ".*break here 1.*"
> +
> +# set test_string ".*0x12345678.*"
> +gdb_test "info register pkru" ".*pkru.*0x12345678.*" "read pkru register"
> +
> +# set test_string ".*0x44444444.*"
> +gdb_test "print /x \$pkru = 0x44444444" "= 0x44444444" "set pkru value"
> +gdb_test "info register pkru" ".*pkru.*0x44444444.*" "read value after setting value"
> +
> +gdb_breakpoint [ gdb_get_line_number "break here 2" ]
> +gdb_continue_to_breakpoint "break here 2" ".*break here 2.*"
> +
> +gdb_test "print /x rd_value" ".*" "variable after reading pkru"

Is this last test too lax?  It'll basically accept anything
but a crash, including an error.

Otherwise it LGTM.

Thanks,
Pedro Alves


  parent reply	other threads:[~2017-01-26 15:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06 10:58 [PATCH v3 0/5] Add support for PKRU register to GDB and GDBServer Michael Sturm
2016-12-06 10:58 ` [PATCH v3 5/5] Add support for Intel PKRU register to GDB and GDBserver Michael Sturm
2016-12-08 15:35   ` Luis Machado
2017-01-26 15:38   ` Pedro Alves [this message]
2017-01-27 15:00     ` Sturm, Michael
2017-01-27 15:22       ` Pedro Alves
2017-02-01 12:34         ` Sturm, Michael
2016-12-06 10:58 ` [PATCH v3 2/5] Change xstate_bv handling to use 8 bytes of data Michael Sturm
2017-01-26 14:46   ` Pedro Alves
2016-12-06 10:58 ` [PATCH v3 3/5] Rename target descriptions to reflect actual content of description Michael Sturm
2017-01-26 14:50   ` Pedro Alves
2017-01-26 15:55     ` Sturm, Michael
2017-01-26 16:17       ` Pedro Alves
2016-12-06 10:58 ` [PATCH v3 1/5] Sync up x86-gcc-cpuid.h with cpuid.h from gcc-6 branch Michael Sturm
2016-12-07 18:28   ` Luis Machado
2016-12-08 12:16     ` Sturm, Michael
2016-12-08 15:35       ` Luis Machado
2017-01-26 14:29   ` Pedro Alves
2016-12-06 10:59 ` [PATCH v3 4/5] Add target description for avx-avx512 Michael Sturm
2017-01-26 14:57   ` Pedro Alves
2017-01-26 16:02     ` Sturm, Michael
     [not found] ` <DB865139DDA33A4DA36CC4A460C112734740AE54@irsmsx105.ger.corp.intel.com>
2017-01-26 14:07   ` [PING][PATCH v3 0/5] Add support for PKRU register to GDB and GDBServer Sturm, Michael

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=c160cf95-ddf6-2c62-963b-588558f6c1d2@redhat.com \
    --to=palves@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=michael.sturm@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