From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103924 invoked by alias); 14 Feb 2019 13:02:03 -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 103906 invoked by uid 89); 14 Feb 2019 13:02:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=H*M:d100, ctrl X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Feb 2019 13:02:01 +0000 Received: by mail-wm1-f65.google.com with SMTP id j125so6026076wmj.1 for ; Thu, 14 Feb 2019 05:02:00 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:75e6:857f:3506:a1f4? ([2001:8a0:f913:f700:75e6:857f:3506:a1f4]) by smtp.gmail.com with ESMTPSA id o12sm669701wrx.53.2019.02.14.05.01.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 05:01:58 -0800 (PST) Subject: Re: [PING][PATCH v2 PR gdb/21870] aarch64: Leftover uncleared debug registers To: Wei-min Pan , Alan Hayward References: <1530148222-12558-1-git-send-email-weimin.pan@oracle.com> <145f2e8d-4321-00a6-650a-bf8f0a483b6f@oracle.com> <7861E9FA-0293-4C16-857A-6935579C7042@arm.com> <3eea53e4-dfc6-ef59-f88f-d35797c26ba6@oracle.com> <31396591-A287-40C5-A4D0-6EAEC8077D6B@arm.com> <563997a0-cd3c-cf6e-8418-bbd452436b2b@oracle.com> <037877d7-a3d3-7ae1-cafa-0bd29927abb2@redhat.com> <3fc1501e-cbf7-7d92-e5a2-8a3ccd4e332e@oracle.com> Cc: "gdb-patches@sourceware.org" , nd From: Pedro Alves Message-ID: <2465cc32-c77d-d100-dde7-419df22e9ae7@redhat.com> Date: Thu, 14 Feb 2019 13:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <3fc1501e-cbf7-7d92-e5a2-8a3ccd4e332e@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-02/txt/msg00216.txt.bz2 On 02/13/2019 09:56 PM, Wei-min Pan wrote: > > On 2/13/2019 3:40 AM, Pedro Alves wrote: >> On 02/12/2019 01:10 AM, Weimin Pan wrote: >>> +clean_restart $testfile >>> + >>> +set test "run to exit" >>> +gdb_test_multiple "run" "$test" { >>> +    -re "exited with code 01.*$gdb_prompt $" { >>> +        pass "$test" >>> +    } >>> +    -re "exited normally.*$gdb_prompt $" { >>> +        pass "$test" >>> +    } >>> +} >> A naked "run" command doesn't work when testing against >> gdbserver with --target_board=native-gdbserver. >> >> Is "run" important here?  Could this use runto_main + "continue" instead? > > As long as the test run doesn't assert, we could instead use > "runto_main + "continue". Thanks for pointing this out. OOC, why does asserting make a difference? > >> Also, the comment at the top of the file says: >> >>   # This test checks that GDB does not alter watchpoints set by an inferior. >>   # It sets a watchpoint on memory then writes to the watched memory. >>   # It will exit with 1 if the watchpoint is not reached. >> >> But I couldn't spot where that "exit with 1" happens in the .c file. > > You are right, it should be "exit with 2". > >> Also, when that happens, we're issuing a pass, as seen above. >> Is that intended? > > "Exit with 1" could happen if the PTRACE_SETREGSET call should > fail which is ok as long as it doesn't cause assertion. I see. Could you add some comments, please? Could you send a patch? BTW: - why is the SET_WATCHPOINT macro necessary? - what does the ??? below mean? dreg_state.dbg_regs[0].ctrl |= 2 << 1; // GDB: ???: enabled at el0 - The code has: atexit (cleanup); (...) but then also calls cleanup() return returning (twice, end of main), which seems unnecessary? - While at it, the gdb_compile + clean_restart in the .exp file could be replaced with a single prepare_for_testing call. > > Thanks for your comments. > Thanks, Pedro Alves