From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57133 invoked by alias); 26 Jul 2017 21:12:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 56602 invoked by uid 89); 26 Jul 2017 21:12:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Jul 2017 21:12:28 +0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6QLCP5A011950 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jul 2017 21:12:25 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v6QLCOqb005296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jul 2017 21:12:25 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v6QLCOZ1006153; Wed, 26 Jul 2017 21:12:24 GMT Received: from [10.159.239.66] (/10.159.239.66) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jul 2017 14:12:24 -0700 Subject: Re: [PATCH v4] gdb: ADI support To: Yao Qi Cc: gdb-patches@sourceware.org References: <1500424890-112103-1-git-send-email-weimin.pan@oracle.com> <86o9s8pmyg.fsf@gmail.com> From: Wei-min Pan Message-ID: Date: Wed, 26 Jul 2017 21:12:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <86o9s8pmyg.fsf@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2017-07/txt/msg00415.txt.bz2 On 7/25/2017 8:15 AM, Yao Qi wrote: > Weimin Pan 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 . */ >> + >> +#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.