From: John Baldwin <jhb@freebsd.org>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Add support for catching system calls to native FreeBSD targets.
Date: Fri, 24 Jun 2016 00:24:00 -0000 [thread overview]
Message-ID: <7374404.qtI4NAOGSQ@ralph.baldwin.cx> (raw)
In-Reply-To: <53d24aec-5588-ea4f-7d6d-085aca553457@redhat.com>
On Monday, June 20, 2016 11:56:40 PM Pedro Alves wrote:
> Hi John,
>
> This looks good to me. Just some minor nits below.
>
> On 06/14/2016 09:57 PM, John Baldwin wrote:
> > versions of FreeBSD include the identifier of the current
> > system call when reporting a system call entry or exit event in the
> > ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait. As
> > such, FreeBSD native targets do not use the gdbarch method to fetch
> > the system call code. In addition, FreeBSD register sets fetched via
> > ptrace do not include an equivalent of 'orig_rax' (on amd64 for
> > example), so the system call code cannot be extracted from the
> > available registers during a system call exit. However, GDB assumes
> > that system call catch points are not supported if the gdbarch method
> > is not present. As a workaround, FreeBSD ABIs install a dummy gdbarch
> > method that throws an internal_error if it is ever invoked.
> >
>
> We should probably get rid of this gdbarch method, by making linux-nat.c
> (the only caller) call an arch-specific target_ops override instead of
> a gdbarch method, like gdbserver's equivalent code does.
>
> To replace the break-catch-syscall.c error, I think that it'd be reasonable
> to remove it altogether, and for Linux targets that don't implement
> the gdbarch hook yet, instead just always intercept all syscalls, reporting
> an <unknown> syscall number.
>
> But what you did seems like a reasonable thing to do as long as do
> have the gdbarch hook.
So I'm not quite sure how to implement an arch-specific target_op.
There are various linux_nat_set_* functions that accept a function pointer
but then just set a global variable. The amd64 version might have to copy
with different ABIs rather than depending on teh i386 gdbarch method, etc.
One option that is a bit smaller in scale would be to move the error
in break-catch-syscall.c into linux_child_set_syscall_catchpoint in
linux-nat.c. It could return 1 to fail the request if the gdbarch
method wasn't present.
--
John Baldwin
next prev parent reply other threads:[~2016-06-24 0:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 20:58 John Baldwin
2016-06-20 17:10 ` John Baldwin
2016-06-20 22:56 ` Pedro Alves
2016-06-24 0:24 ` John Baldwin [this message]
2016-06-24 15:52 ` Pedro Alves
2016-06-24 17:57 ` John Baldwin
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=7374404.qtI4NAOGSQ@ralph.baldwin.cx \
--to=jhb@freebsd.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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