public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: John Baldwin <jhb@FreeBSD.org>, Simon Marchi <simark@simark.ca>,
	gdb-patches@sourceware.org
Subject: Re: [RFC 1/3] [gdb] Call gdbarch_get_syscall_number less often
Date: Wed, 22 Nov 2023 13:58:51 +0100	[thread overview]
Message-ID: <8fb563c9-5cf6-479c-a99f-50153840068b@suse.de> (raw)
In-Reply-To: <98ef5a4a-f08d-4ae0-bdda-ad1684c0c22b@FreeBSD.org>

On 11/21/23 23:17, John Baldwin wrote:
> 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?
> 

Thanks for the suggestion, but I went with a solution in 
linux_resume_one_lwp_throw ( 
https://sourceware.org/pipermail/gdb-patches/2023-November/204407.html ) .

AFAIU it should handle the corner case Simon mentions.

Thanks,
- Tom


      reply	other threads:[~2023-11-22 12:56 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
2023-11-22 12:58           ` Tom de Vries [this message]

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=8fb563c9-5cf6-479c-a99f-50153840068b@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=simark@simark.ca \
    /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).