Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Eager <eager@eagerm.com>
To: Pedro Alves <palves@redhat.com>
Cc: "Maciej W. Rozycki" <macro@codesourcery.com>,
	 "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: MIPS Linux signals
Date: Tue, 22 May 2012 19:32:00 -0000	[thread overview]
Message-ID: <4FBBE9AC.5030200@eagerm.com> (raw)
In-Reply-To: <4FBBDB61.7070002@redhat.com>

On 05/22/2012 11:30 AM, Pedro Alves wrote:
> On 05/22/2012 07:14 PM, Michael Eager wrote:
>
>> On 05/22/2012 09:01 AM, Pedro Alves wrote:
>>
>>>>> target_signal_from_host =>    gdb_signal_from_host (or gdb_signal_from_host_signal)
>>>>> target_signal_to_host =>    gdb_signal_to_host (or gdb_signal_to_host_signal)
>>>>>
>>>>> gdbarch_target_signal_from_host =>    gdbarch_gdb_signal_from_target (or gdbarch_gdb_signal_from_target_signal)
>>>>> gdbarch_target_signal_to_host =>    gdbarch_gdb_signal_to_target (or gdbarch_gdb_signal_to_target_signal)
>>>>
>>>> OK, but I'd recommend
>>>>     target_signal_from_host =>    gdb_signal_from_target
>>>>     target_signal_to_host =>    gdb_signal_to_target
>>>>
>>>> This is symmetric with the gdbarch_ functions and clear that the function
>>>> translates to/from target system values, not the host system.
>>>
>>>
>
>
>>> But it's not what the functions do...  They really convert from the host
>>> system signals, not the target's.  I think the symmetry will only lead to
>>> people getting confused (which one to call in common/target-independent code?).
>>
>> If you are running GDB on a Windows host, for example, what host
>> system signals are you translating?
>
>
> There's only be one such call -- the one from within corelow.c, if there's no
> gdbarch_target_signal_from_host callback installed.  (The Windows ports don't call
> target_signal_from_host anywhere (windows-nat.c and friends).  And in that case, if
> you e.g., load a cygwin core, the target_signal_from_host fallback will try to
> convert the signal number as if it was a host signal number.  If you're running g
> b on a cygwin host, you'll happen to get the right values.  If you're debugging
> a core (that same core or of some other non-native arch) with a cross debugger, with
> a mingw hosted gdb, then target_signal_from_host will _still_ translate the signal
> numbers found in mingw's signal.h header.  For reference, those are:
>
> #define SIGINT          2       /* Interactive attention */
> #define SIGILL          4       /* Illegal instruction */
> #define SIGFPE          8       /* Floating point error */
> #define SIGSEGV         11      /* Segmentation violation */
> #define SIGTERM         15      /* Termination request */
> #define SIGBREAK        21      /* Control-break */
> #define SIGABRT         22      /* Abnormal termination (abort) */
>
> All other signal numbers you pass to target_signal_from_host will end up
> as TARGET_SIGNAL_UNKNOWN, due to the bunch of #ifdef SIGFOO bits in
> common/signals.  Obviously, in most cases, this translation will
> be wrong.  But the point to be taken is, target_signal_from_host _always_
> translates the signal number passed as argument as if it was a host
> signal number, no matter what the target really is.

I think the point is that a target signal number should
always be treated as if it were from a target, never
that it was from the host.

All the #ifdefs checking if the host has this signal or that
is confusing.  The only thing that seems relevant to me is
whether the target has these signals.  If it happens that
target==host, then these happen to be equivalent.  But maintaining
a clear target abstraction is a benefit.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


  reply	other threads:[~2012-05-22 19:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-20  2:03 Michael Eager
2012-05-21 11:04 ` Pedro Alves
2012-05-21 14:51   ` Michael Eager
2012-05-21 17:37     ` Pedro Alves
2012-05-21 18:06       ` Michael Eager
2012-05-21 18:19 ` Maciej W. Rozycki
     [not found] ` <alpine.DEB.1.10.1205211232260.11227@tp.orcam.me.uk>
2012-05-21 18:21   ` Michael Eager
2012-05-21 22:34     ` Maciej W. Rozycki
2012-05-22  9:38       ` Pedro Alves
2012-05-21 21:35 ` Pedro Alves
2012-05-21 21:53   ` Michael Eager
2012-05-21 22:48     ` Maciej W. Rozycki
2012-05-22  0:16       ` Michael Eager
2012-05-22 10:17       ` Pedro Alves
2012-05-22 13:16         ` Maciej W. Rozycki
2012-05-22 13:32           ` Pedro Alves
2012-05-22 15:10         ` Move store_waitstatus to inf-child.c (was: Re: MIPS Linux signals) Pedro Alves
2012-05-22 15:40         ` MIPS Linux signals Michael Eager
2012-05-22 16:02           ` Pedro Alves
2012-05-22 18:14             ` Michael Eager
2012-05-22 18:31               ` Pedro Alves
2012-05-22 19:32                 ` Michael Eager [this message]
2012-05-22 22:06                   ` Pedro Alves
2012-05-22 16:26         ` Pedro Alves
2012-05-22 10:58       ` Pedro Alves
2012-05-22 19:31         ` Aleksandar Ristovski
2012-05-22 21:55           ` Pedro Alves
2012-05-22 23:29             ` Aleksandar Ristovski
2012-05-23 11:39               ` Pedro Alves

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=4FBBE9AC.5030200@eagerm.com \
    --to=eager@eagerm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@codesourcery.com \
    --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