public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Wei-min Pan <weimin.pan@oracle.com>, Alan Hayward <Alan.Hayward@arm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	nd <nd@arm.com>
Subject: Re: [PING][PATCH v2 PR gdb/21870] aarch64: Leftover uncleared debug registers
Date: Thu, 14 Feb 2019 13:02:00 -0000	[thread overview]
Message-ID: <2465cc32-c77d-d100-dde7-419df22e9ae7@redhat.com> (raw)
In-Reply-To: <3fc1501e-cbf7-7d92-e5a2-8a3ccd4e332e@oracle.com>

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

  reply	other threads:[~2019-02-14 13:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1530148222-12558-1-git-send-email-weimin.pan@oracle.com>
     [not found] ` <145f2e8d-4321-00a6-650a-bf8f0a483b6f@oracle.com>
2019-02-06  0:51   ` Weimin Pan
2019-02-06 12:43     ` Alan Hayward
2019-02-06 22:36       ` Wei-min Pan
2019-02-07 12:49         ` Alan Hayward
2019-02-07 21:39           ` Wei-min Pan
2019-02-11 15:24             ` Alan Hayward
2019-02-12  1:10               ` Weimin Pan
2019-02-12 14:46                 ` Alan Hayward
2019-02-13  1:05                   ` Weimin Pan
2019-02-13 11:40                 ` Pedro Alves
2019-02-13 21:57                   ` Wei-min Pan
2019-02-14 13:02                     ` Pedro Alves [this message]
2019-02-14 22:42                       ` Wei-min Pan
     [not found] <1530144022-12110-1-git-send-email-weimin.pan@oracle.com>
2018-07-12  2:01 ` [PING] [PATCH " Wei-min 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=2465cc32-c77d-d100-dde7-419df22e9ae7@redhat.com \
    --to=palves@redhat.com \
    --cc=Alan.Hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    --cc=weimin.pan@oracle.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).