Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wei-min Pan <weimin.pan@oracle.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4] gdb: ADI support
Date: Wed, 26 Jul 2017 21:12:00 -0000	[thread overview]
Message-ID: <ca2fbf2e-7740-ee34-ac4f-471458991cba@oracle.com> (raw)
In-Reply-To: <86o9s8pmyg.fsf@gmail.com>


On 7/25/2017 8:15 AM, Yao Qi wrote:
> Weimin Pan <weimin.pan@oracle.com> writes:
>
>> +/* Per-process ADI stat info.  */
>> +
>> +struct sparc64_adi_info
>> +{
>> +  /* The process identifier.  */
>> +  pid_t pid;
>> +
>> +  /* The ADI stat.  */
>> +  struct adi_stat_t stat;
>> +
>> +  /* Linked list.  */
>> +  struct sparc64_adi_info *next;
>> +};
> Use C++ STL list.  I suggested it on the v3 review.

I'm using forward_list to replace the linked list.

> ...
>> +++ b/gdb/testsuite/gdb.arch/sparc64-adi.c
>> @@ -0,0 +1,135 @@
>> +/* Application Data Integrity (ADI) test in sparc64.
>> +
>> +   Copyright 2017 Free Software Foundation, Inc.
>> +
>> +   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/>.  */
>> +
>> +#include "sparc64-adilib.h"
>> +
>> +#define MAPSIZE 8192
>> +#define SHMSIZE 102400
>> +#ifndef PROT_ADI
>> +#define PROT_ADI 0x10
>> +#endif
>> +
>> +static int
>> +memory_fill(char *addr, size_t size, int pattern)
>> +{
> In general, the test case should follow the GNU coding standard too.

OK, done.

> .....
>
>> +    return -1
>> +}
>> +
>> +if ![runto_main] then {
>> +    untested "could not run to main"
>> +    return -1
>> +}
>> +
>> +gdb_test "break [gdb_get_line_number "line breakpoint here"]" \
>> +         "Breakpoint .* at .*${srcfile}.*" \
>> +         "set line breakpoint in main"
>> +gdb_continue_to_breakpoint "continue to line breakpoint in main"
>> +
>> +##########################################
>> +set newadi "7"
>> +gdb_test "adi x shmaddr" "" "examine ADI"
> Can you match the output?

Here are the results of running this new test:

% make check TESTS="gdb.arch/sparc64-adi.exp"
...
...

                 === gdb tests ===

Schedule of variations:
     unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file 
for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for 
target.
Using ~/binutils-gdb/gdb/testsuite/config/unix.exp as 
tool-and-target-specific interface file.
Running ~/binutils-gdb/gdb/testsuite/gdb.arch/sparc64-adi.exp ...

                 === gdb Summary ===

# of expected passes            7
...

>> +gdb_test "adi a/100 shmaddr=${newadi}" "" "assign ADI"
> Likewise.
>
>> +gdb_test "adi x/100 shmaddr" \
>> +"0x\[0-9a-f\]+00:.*\t${newadi} ${newadi}.*" "examine new ADI"
>> +gdb_test "adi a/100 shmaddr=0x0" "" "reset ADI"
>> +gdb_test "continue" \
>> +         ".*Program received signal SIGSEGV.*
>> +.*ADI precise mismatch while accessing address.*" \
>> +	"continue to sigsegv"
>> diff --git a/gdb/testsuite/gdb.arch/sparc64-adilib.h b/gdb/testsuite/gdb.arch/sparc64-adilib.h
>> new file mode 100755
>> index 0000000..add026c
>> --- /dev/null
>> +++ b/gdb/testsuite/gdb.arch/sparc64-adilib.h
>> @@ -0,0 +1,24 @@
> Why do you need a header?
>

Merged the header file into sparc64-adi.c.


  parent reply	other threads:[~2017-07-26 21:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19  0:49 Weimin Pan
2017-07-25 15:16 ` Yao Qi
2017-07-25 15:31   ` Jose E. Marchesi
2017-07-25 16:44     ` Yao Qi
2017-07-26 21:12   ` Wei-min Pan [this message]
2017-07-27 11:17     ` Yao Qi
2017-07-27 16:34       ` Wei-min Pan
2017-07-28 10:30         ` Yao Qi
2017-07-28 16:34           ` Wei-min Pan
     [not found]             ` <868tj3ml8s.fsf@gmail.com>
2017-08-01 17:41               ` Wei-min Pan
2017-07-25 19:19 Weimin Pan
2017-07-25 20:18 ` Simon Marchi
2017-07-25 21:03   ` Jose E. Marchesi
2017-07-25 22:37 Weimin Pan
2017-08-01 23:30 Weimin Pan
2017-08-02  7:55 ` Yao Qi
2017-08-02 18:00   ` Wei-min Pan
2017-08-04 11:57     ` Yao Qi
2017-08-04 22:46 Weimin Pan

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=ca2fbf2e-7740-ee34-ac4f-471458991cba@oracle.com \
    --to=weimin.pan@oracle.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.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