public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <alves.ped@gmail.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org,
	Daniel Jacobowitz <dan@codesourcery.com>,
	Joel Brobecker <brobecker@adacore.com>,
	Eli Zaretskii <eliz@gnu.org>,
	Mark Kettenis <mark.kettenis@xs4all.nl>
Subject: Re: [patch 1/9]#2 Rename `enum target_signal' to target_signal_t
Date: Thu, 02 Sep 2010 19:02:00 -0000	[thread overview]
Message-ID: <201009021827.52710.alves.ped@gmail.com> (raw)
In-Reply-To: <20100902103122.GA11298@host1.dyn.jankratochvil.net>

On Thursday 02 September 2010 11:31:22, Jan Kratochvil wrote:
> On Thu, 02 Sep 2010 03:54:47 +0200, Pedro Alves wrote:
> > A target_signal_o array to hold
> > all the possible gdb signals, and a target_signal becomes:
> > 
> > typedef const struct target_signal_o * target_signal;
> 
> This means there is abandoned the possibility to associate dynamic information
> with a signal (such as to associate siginfo_t with it).  Target signal (SIG*)
> without its siginfo_t is an incomplete information.  Therefore I was
> automatically trying to fix this problem before.

I don't think it is a good idea to associate the siginfo with a signal
and think of it as a single entity.  For many cases, you don't need the
siginfo.  Carrying it around would be extra burden, especially for the remote
target.  For example, consider a signal set to "pass nostop".  GDB does not
need to read the whole siginfo to decide whether the signal should be passed
down straight to the inferior.  IMO, it is better to leave
a "target_signal" being a tag into which signal triggered, and keep the
siginfo a separate object, which may or not be available, even.

> and TARGET_SIGNAL_SIGTRAP should be called
> TARGET_SIGNAL_BREAKPOINT_HIT etc.  

I'm not sure that would be a good idea either.  That's not a
signal in the "unix sense".  A breakpoint hit is a higher
level event than a SIGTRAP.
If the target can determine itself that a breakpoint triggered, and
we want to carry that info to infrun, we can either add a new
waitkind for it (and associate any necessary info along) if it doesn't
make sense to associate the event with a signal, or have the core
ask the target if it can explain the TARGET_SIGNAL_TRAP (much like
watchpoints are handled).  In any case, for a new breakpoint
hit waitkind (TARGET_WAITKIND_BREAKPOINT_HIT or something.
Think of TARGET_WAITKIND_FORK|VFORK|EXEC), you
wouldn't need to give infrun the whole siginfo either.  At the
remote protocol level, you'd probably have the remote stub transfer
something like "T05 bkpt", rather than a stop reply with the
whole siginfo.  Consider the remote protocol and software
single-step targets.  You don't want to have to transfer
the whole siginfo blob back and forth for each single-step.
I don't think I mentioned it yet, but I'm presently working on a
stub for an OS where "signal info" size is _not_ a hard constant,
and can be 2048 bytes, if not more.

> But a full signals abstraction is a too
> expensive/naive/unreal clean-up project for now.)

We can consider TARGET_WAITKIND_STOPPED to be an event
associated with a boring old unix-like signal, and add
other high level waitkinds for other things.  Or reuse
the waitking and add more flags to it.  In any case,
even if we got rid of the gdb-signal <-> host-signals
mapping completely (which would be underirable as it would mean
we'd need to teach gdb about any random OS we want to use
remote debugging with), embedding more info _within_ a simple
signal id appears wrong to me.  And that's what the whole
series was about, and I think we're in agreement on that now.

> typedef struct
>   {
>     enum target_signal_number sig;  /* TARGET_SIGNAL_* 30 possibilities */
>     int host_signal;  /* untranslated SIG* number for TARGET_SIGNAL_UNKNOWN.  */
>   } target_signal;
>  - Naming is kept compatible with current GDB naming.  The reality is:
>    s/target_signal/gdb_signal/
>    s/host_signal/target_signal/
> 
> Target could provide a number-name table for the `handle' command covering
> just the specific 64 signals available at the Linux target (instead of the 150
> ones from the TARGET_SIGNAL_* list).

It could.  For remote targets, there would need to be a fallback for
a table of the current whole gdb signal numbers, and a way to select
the correct table for the remote os/target --- based on osabi, or fully
described in the target description.  If you get rid of the gdb generic
signals from infrun.c completely, some things might become
weird if you don't have such a mechanism, like "signal FOO" sending
one signal when native debugging, and another when remote debugging.

-- 
Pedro Alves

  parent reply	other threads:[~2010-09-02 17:28 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30  7:11 Jan Kratochvil
2010-08-30  8:14 ` Mark Kettenis
2010-08-30  8:24   ` Jan Kratochvil
2010-08-30 10:09     ` Eli Zaretskii
2010-08-30 11:11       ` Mark Kettenis
2010-08-30 14:08         ` Joel Brobecker
2010-08-31 18:28           ` Jan Kratochvil
2010-08-31 18:45             ` Mark Kettenis
2010-09-01  2:03             ` Joel Brobecker
2010-09-01 18:18             ` Joel Brobecker
2010-09-01 18:30               ` Jan Kratochvil
2010-09-01 18:38                 ` Pedro Alves
2010-09-01 18:45                   ` Jan Kratochvil
2010-09-01 18:40                 ` Joel Brobecker
2010-09-01 18:51                   ` Jan Kratochvil
2010-09-01 19:08                     ` Pedro Alves
2010-09-01 19:28                       ` Jan Kratochvil
2010-09-01 20:06                         ` Pedro Alves
2010-09-01 20:06                           ` Daniel Jacobowitz
2010-09-01 20:10                             ` Pedro Alves
2010-09-02  9:46                               ` Pedro Alves
2010-09-02 14:01                                 ` Jan Kratochvil
2010-09-02 15:36                                   ` Joel Brobecker
2010-09-02 19:02                                   ` Pedro Alves [this message]
2010-09-02 20:46                                     ` Jan Kratochvil
2010-09-07 18:59                                       ` Jan Kratochvil
2010-09-02 16:02                                 ` Joel Brobecker
2010-09-02 17:04                                   ` Jan Kratochvil
2010-09-06  0:29                                 ` Jan Kratochvil
2010-09-06 13:30                                   ` Pedro Alves
2010-09-06 14:52                                     ` Jan Kratochvil
2010-09-08 23:42                                 ` Jan Kratochvil
2010-09-01 20:23                           ` Jan Kratochvil
2010-09-01 20:30                             ` Mark Kettenis
2010-09-01 20:47                             ` Pedro Alves
2010-09-01 21:32                         ` Joseph S. Myers
2010-09-01 19:12                     ` Joel Brobecker
2010-09-01 22:37                     ` Tom Tromey
2010-08-30 14:11         ` Eli Zaretskii
2010-08-30 17:34     ` Michael Snyder

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=201009021827.52710.alves.ped@gmail.com \
    --to=alves.ped@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=dan@codesourcery.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /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).