From: Josh Stone <jistone@redhat.com>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Cc: philippe.waroquiers@skynet.be, sergiodj@redhat.com, eliz@gnu.org,
xdje42@gmail.com, scox@redhat.com
Subject: Re: [PATCH v4] Implement 'catch syscall' for gdbserver
Date: Tue, 12 Jan 2016 19:10:00 -0000 [thread overview]
Message-ID: <56954F8C.6010100@redhat.com> (raw)
In-Reply-To: <5694EC0E.2080904@redhat.com>
On 01/12/2016 04:05 AM, Pedro Alves wrote:
> On 01/09/2016 03:09 AM, Josh Stone wrote:
>
>>
>> 2016-01-08 Josh Stone <jistone@redhat.com>
>> Philippe Waroquiers <philippe.waroquiers@skynet.be>
>>
>> * gdb.texinfo (Remote Configuration): List the QCatchSyscalls packet.
>> (Stop Reply Packets): List the syscall entry and return stop reasons.
>> (General Query Packets): Describe QCatchSyscalls, and add it to the
>> table and detailed list of stub features.
>>
>
> "table of detailed", I think.
I'm referring to two hunks:
- the table: Feature Name / Value Required / Default / Probe Allowed
- the list below it, "currently defined stub features, in more detail"
Maybe I just need another article, "to the table and the detailed list"
>> @@ -648,6 +658,12 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
>> event_thr->last_resume_kind = resume_continue;
>> event_thr->last_status.kind = TARGET_WAITKIND_IGNORE;
>>
>> + /* Update syscall state in the new lwp, effectively mid-syscall too.
>> + The client really should send a new list to catch, in case the
>> + architecture changed, but for ANY_SYSCALL it doesn't matter. */
>> + event_lwp->syscall_state = TARGET_WAITKIND_SYSCALL_ENTRY;
>> + proc->syscalls_to_catch = syscalls_to_catch;
>
> The tone of this comment sounds to me as if the client should always
> send a new list, just in case, but for some odd reason it sometimes doesn't.
>
> I think we want to convey the opposite, like:
>
> /* Update syscall state in the new lwp, effectively mid-syscall too. */
> event_lwp->syscall_state = TARGET_WAITKIND_SYSCALL_ENTRY;
>
> /* Restore the list to catch. Don't rely on the client, which is free
> to avoid sending a new list when the architecture doesn't change.
> Also, for ANY_SYSCALL, the architecture doesn't really matter. */
> proc->syscalls_to_catch = syscalls_to_catch;
Sure, I'll take your rewrite verbatim, if you don't mind.
>> static int
>> +linux_supports_catch_syscall (void)
>> +{
>> + return (the_low_target.get_syscall_trapinfo != NULL
>> + && linux_supports_tracesysgood());
>
> Space: "linux_supports_tracesysgood ()"
OK
>> +proc test_catch_syscall_execve {} {
>> + global gdb_prompt decimal
>> +
>> + with_test_prefix "execve" {
>> +
>> + # Tell the test program we want an execve.
>> + gdb_test_no_output "set do_execve = 1"
>> +
>> + # Check for entry/return across the execve, making sure that the
>> + # syscall_state isn't lost when turning into a new process.
>> + insert_catch_syscall_with_arg "execve"
>> + check_continue "execve"
>> +
>> + # Remotes that don't track exec may report the raw SIGTRAP for it.
>> + # If we use stepi now, we'll get a consistent trap for all targets.
>> + gdb_test "stepi" ".*" "step after execve"
>
> Why is it important to do this raw SIGTRAP handling? What happens if you don't
> do this? Won't those targets already FAIL the check_continue tests?
Just in case, the context from Linux man ptrace:
If the PTRACE_O_TRACEEXEC option is not in effect for the execing
tracee, and if the tracee was PTRACE_ATTACHed rather that
PTRACE_SEIZEd, the kernel delivers an extra SIGTRAP to the tracee
after execve(2) returns. This is an ordinary signal (similar to
one which can be generated by kill -TRAP), not a special kind of
ptrace-stop.
Since that's a signal-stop *after* execve returns, the check_continue
will have succeeded already.
The check_continue is really the only bit I care about for this test
anyway. The rest is just trying to finish the target process cleanly.
I was having trouble matching consistent output since plain remote was
getting that SIGTRAP, but extended-remote would use exec events and not
report anything extra. Adding the stepi made both stop the same way.
This is moot now, since plain remotes are now tracking exec events too.
I developed this test just before that went in last month. :)
I just tried with that stepi commented out, and the test still passes on
local, remote, and extended-remote, so I'll remove it.
next prev parent reply other threads:[~2016-01-12 19:10 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-30 11:02 [PATCH] " Josh Stone
2015-10-30 13:26 ` Eli Zaretskii
2015-11-01 22:15 ` Doug Evans
2015-11-02 18:24 ` Josh Stone
2015-11-21 10:29 ` Philippe Waroquiers
2015-11-23 4:20 ` Doug Evans
2015-11-23 4:20 ` Doug Evans
2015-11-25 2:37 ` Josh Stone
2015-11-26 2:53 ` [PATCH v2 1/2] gdbserver: Set Linux ptrace options ASAP Josh Stone
2015-11-26 2:54 ` [PATCH v2 2/2] Implement 'catch syscall' for gdbserver Josh Stone
2015-11-26 10:34 ` [PATCH v2 1/2] gdbserver: Set Linux ptrace options ASAP Pedro Alves
2015-11-30 18:50 ` Josh Stone
2015-12-01 20:17 ` Josh Stone
2015-12-02 14:01 ` Pedro Alves
2015-12-04 2:26 ` [PATCH v3 1/2] gdbserver: set ptrace flags after creating inferiors Josh Stone
2015-12-04 2:27 ` [PATCH v3 2/2] Implement 'catch syscall' for gdbserver Josh Stone
2015-12-04 8:45 ` Eli Zaretskii
2015-12-05 2:14 ` Josh Stone
2015-12-05 8:02 ` Eli Zaretskii
2015-12-07 16:50 ` Josh Stone
2015-12-07 17:15 ` Eli Zaretskii
2015-12-04 13:18 ` Pedro Alves
2015-12-05 2:16 ` Josh Stone
2015-12-08 13:31 ` Pedro Alves
2015-12-08 19:02 ` Josh Stone
2015-12-08 13:37 ` Pedro Alves
2015-12-11 21:19 ` Josh Stone
2015-12-16 15:42 ` Pedro Alves
2016-01-09 3:09 ` [PATCH v4] " Josh Stone
2016-01-09 7:37 ` Eli Zaretskii
2016-01-11 17:44 ` Philippe Waroquiers
2016-01-12 12:05 ` Pedro Alves
2016-01-12 19:10 ` Josh Stone [this message]
2016-01-12 19:22 ` Pedro Alves
2016-01-12 20:01 ` Josh Stone
2016-03-29 14:27 ` Yao Qi
2016-03-29 18:12 ` Josh Stone
2016-03-29 23:49 ` Josh Stone
2016-03-30 12:23 ` Yao Qi
2016-03-31 1:10 ` Josh Stone
2016-04-01 13:05 ` Yao Qi
2016-04-01 16:38 ` Josh Stone
2016-05-29 16:47 ` [doc] NEWS: QCatchSyscalls: simplify Jan Kratochvil
2016-05-29 17:29 ` Eli Zaretskii
2016-05-29 17:50 ` Jan Kratochvil
2016-05-29 18:19 ` Eli Zaretskii
2016-05-29 18:47 ` [commit] " Jan Kratochvil
2015-12-04 12:16 ` [PATCH v3 1/2] gdbserver: set ptrace flags after creating inferiors Pedro Alves
2015-12-05 2:14 ` Josh Stone
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=56954F8C.6010100@redhat.com \
--to=jistone@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=philippe.waroquiers@skynet.be \
--cc=scox@redhat.com \
--cc=sergiodj@redhat.com \
--cc=xdje42@gmail.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