public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Simon Marchi <simark@simark.ca>, Tom de Vries <tdevries@suse.de>,
	gdb-patches@sourceware.org
Subject: Re: [RFC 1/3] [gdb] Call gdbarch_get_syscall_number less often
Date: Tue, 21 Nov 2023 14:17:12 -0800	[thread overview]
Message-ID: <98ef5a4a-f08d-4ae0-bdda-ad1684c0c22b@FreeBSD.org> (raw)
In-Reply-To: <5f90118c-c99f-44df-9a9a-9ab291430797@simark.ca>

On 11/21/23 1:19 PM, Simon Marchi wrote:
> On 11/21/23 13:03, John Baldwin wrote:
>> I think you can use linux_nat_target::set_syscall_catchpoint to do the
>> invalidation.  From my reading it is called each time a syscall catchpoint
>> is added or removed, and needed is set to false if there are no more
>> catchpoints (so syscall catches are disabled).   I think that means
>> you could do something like:
>>
>> linux_nat_target::set_syscall_catchpoint ()
>> {
>>    if (!needed)
>>      iterate_over_lwps (ptid_t (pid), [] (struct lwp_info *lp)
>>                         {
>>                           lp->syscall_number = -1;
>>                         });
>> }
> 
> What about this corner case of a corner case:
> 
>   1. you have a syscall catchpoint, you hit it (the syscall entry)
>   2. you delete the syscall catchpoint
>   3. you create a syscall catchpoint again
>   4. you continue, expecting to hit the syscall exit
> 
> Will step 2 cause set_syscall_catchpoint to be called, and will we
> therefore lose the information that would have been useful at step 4?

Yes, but I think the generation counter idea is subject to the same issue
unless in both cases you actually defer the geneation bump (or clearing
syscall_number to -1) until you resume the lwp.  For that approach
perhaps you could reset syscall_number to -1 in linux_resume_one_lwp_throw
if catch_syscalls_enabled is zero?

-- 
John Baldwin


  reply	other threads:[~2023-11-21 22:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 15:37 Tom de Vries
2023-11-20 15:37 ` [RFC 2/3] [gdb/tdep] Add gdbarch_extended_event_to_syscall Tom de Vries
2023-11-20 15:37 ` [RFC 3/3] [gdb] Use ptrace events to get current syscall Tom de Vries
2023-11-20 16:12 ` [RFC 1/3] [gdb] Call gdbarch_get_syscall_number less often Simon Marchi
2023-11-21  0:29   ` John Baldwin
2023-11-21 10:26     ` Tom de Vries
2023-11-21 17:54       ` John Baldwin
2023-11-21  2:43   ` Simon Marchi
2023-11-21 11:08   ` Tom de Vries
2023-11-21 18:03     ` John Baldwin
2023-11-21 21:19       ` Simon Marchi
2023-11-21 22:17         ` John Baldwin [this message]
2023-11-22 12:58           ` 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=98ef5a4a-f08d-4ae0-bdda-ad1684c0c22b@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tdevries@suse.de \
    /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).