public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] [gdb/tdep] Add syscall number cache
Date: Mon, 27 Nov 2023 21:25:06 +0100	[thread overview]
Message-ID: <007221a0-dd25-4868-98d9-e133d1ada4e7@suse.de> (raw)
In-Reply-To: <76d0f97a-a2ff-42d0-a31b-49d7b155080f@simark.ca>

On 11/27/23 16:52, Simon Marchi wrote:
> On 11/24/23 17:19, Tom de Vries wrote:
>>> If we're going to use lp->syscall_number (if it is not -1) and it
>>> disagrees with gdbarch_get_syscall_number, what's the point in calling
>>> gdbarch_get_syscall_number in the first place?
>>
>> The debug printf that notes the override of gdbarch_get_syscall_number by the cached syscall number.
>>
>>> Should the logic be:
>>>
>>>     if (new_syscall_state == TARGET_WAITKIND_SYSCALL_RETURN
>>>         && lp->syscall_number != -1)
>>>       // use lp->syscall_number
>>>     else
>>>       // call gdbarch_get_syscall_number
>>>
>>> ?
>>
>> If we don't care about that particular type of debug printf, then yes.
> 
> In my opinion it doesn't add any value to call
> gdbarch_get_syscall_number just to be able to make that debug printf.

OK, fixed in a v2 ( 
https://sourceware.org/pipermail/gdb-patches/2023-November/204553.html ).

I've also added another case in linux_handle_syscall_trap of syscall 
cache invalidation:
...
@@ -1791,6 +1826,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, 
int stopping)
  	 "PTRACE_CONT for SIGSTOP", syscall_number, lp->ptid.lwp ());

        lp->syscall_state = TARGET_WAITKIND_IGNORE;
+      lp->syscall_number = -1;
        ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
        lp->stopped = 0;
        return 1;
...

Thanks,
- Tom


      reply	other threads:[~2023-11-27 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22  9:10 Tom de Vries
2023-11-22  9:10 ` [PATCH 2/3] [gdb/tdep] Add gdbarch_extended_event_to_syscall Tom de Vries
2023-11-22  9:10 ` [PATCH 3/3] [gdb/tdep] Use ptrace events to get current syscall Tom de Vries
2023-11-22 16:16 ` [PATCH 1/3] [gdb/tdep] Add syscall number cache John Baldwin
2023-11-24 21:09 ` Simon Marchi
2023-11-24 22:19   ` Tom de Vries
2023-11-27 15:52     ` Simon Marchi
2023-11-27 20:25       ` 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=007221a0-dd25-4868-98d9-e133d1ada4e7@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.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).