Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/tdep] Fix gdb.base/watchpoint-running on {arm, ppc64le}-linux
Date: Fri, 21 Jun 2024 11:43:52 +0200	[thread overview]
Message-ID: <ec9121d9-5631-441d-91fb-0c12456fb9a0@suse.de> (raw)
In-Reply-To: <e94756ae-be98-443d-8a27-66a9c2672031@palves.net>

On 6/20/24 20:15, Pedro Alves wrote:
> On 2024-06-17 19:22, Tom de Vries wrote:
>> On 6/14/24 18:49, Pedro Alves wrote:
> 
>>> And, from another angle, why isn't aarch64 doing the same, why two mechanisms?
>>
>> Well, the patch adds a fallback, that aarch64 doesn't need, but that powerpc and arm do need.
>>
> 
> Aarch64 absolutely needs it, it's just that it already has the fix in place (by checking early in
> post_startup_inferior/post_attach).  We're adding code to the other backends to handle it too, but using a
> somewhat different solution.  If arm / ppc were being adjusted to use the same approach as aarch64 (like in a
> previous patch in bugzilla), then I wouldn't have asked that question.  I see no good reason for multiple ways
> of doing the same thing.
> 

To formulate it a bit differently: the fallback implementation enables 
only lazy implementations.  Aarch64 doesn't have a lazy implementation, 
so it doesn't need the fallback.  Both arm and ppc do have lazy 
implementations, which is why the fallback works for those.

If we'd drop the calls to aarch64_linux_get_debug_reg_capacity from both 
aarch64_linux_nat_target::post_startup_inferior and 
aarch64_linux_nat_target::post_attach, the fallback wouldn't help, we'd 
have to a add a call to aarch64_linux_get_debug_reg_capacity in probably 
an override of can_use_hw_breakpoint.  In which case I prefer the 
current solution for aarch64.

>> There might be other targets that needs such a fallback, but that we don't know about.
> 
> We have a testcase that will show us if so.
> 

To which my first thought is: And why not have a trivial fix that might 
work for some of those targets and make that test-case pass.

I suppose we're weighing a trade-off between:
- reducing complexity by ensuring to do things in one way only, and
- catering for an unknown subset of target implementations in a common
   implementation.

I don't see a good way or principle to decide between those, my 
preference is clearly on the latter but I do understand the importance 
of the former.

Anyway, since this is a point of contention, I didn't include it in the 
tested patch, so ... moving on.

>> So, I don't mind your patch, it's certainly cleaner, but I don't mind a functional default implementation either.
>> So, I'd move the target_can_use_hardware_watchpoint call to the default implementation of low_init_process.
> 
> I'd rather not.  Let low level handle low level things using low level details.
> 
>> I ran into trouble building the patch due to type of pid parameter mismatches.
>>
>> After fixing that, I ran into trouble on ppc64le, because low_prepare_to_resume is called before low_init_process.
> 
> I guess it's while running through the shell, now that I think about it.
> 
>> I fixed that by sinking this code in the function a bit:
>> ...
>>    if (m_dreg_interface.unavailable_p ())
>>      return;
>> ...
> 
> Makes sense.
> 
>>
>> And after fixing this, I still ran into failures and identified at least two more locations that needed fixing due to the cleanup, at which point I decided that the cleanup part is out-of-scope for the patch fixing the PR.
> 
> OK.
> 
>>
>> So, this is what I have tested on x86_64-linux, aarch64-linux, arm-linux and ppc64le-linux.
> 
> OK, let's go with this, then.  Thank for testing!

I've submitted a v2 ( 
https://sourceware.org/pipermail/gdb-patches/2024-June/210138.html ), 
with comments a bit expanded, and commit log copied from v1 and updated.

Thanks,
- Tom


  reply	other threads:[~2024-06-21  9:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07  6:35 Tom de Vries
2024-06-07 10:18 ` Luis Machado
2024-06-07 12:05   ` Tom de Vries
2024-06-13  9:07     ` Tom de Vries
2024-06-13  9:08       ` Luis Machado
2024-06-14 16:49 ` Pedro Alves
2024-06-17 18:22   ` Tom de Vries
2024-06-20 13:49     ` Tom de Vries
2024-06-20 18:15     ` Pedro Alves
2024-06-21  9:43       ` Tom de Vries [this message]
2024-06-21 12:44         ` Pedro Alves
2024-06-21 14:51           ` Tom de Vries

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=ec9121d9-5631-441d-91fb-0c12456fb9a0@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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