return TARGET_SIGNAL_INFO;
#endif
+#if defined (VKI_SIGRTMIN)
+ if (hostsig >= VKI_SIGRTMIN && hostsig < VKI_SIGRTMAX) {
+ /* This block of TARGET_SIGNAL_REALTIME value is in order. */
+ if (33 <= hostsig && hostsig <= 63)
+ return (enum target_signal)
+ (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
+ else if (hostsig == 32)
+ return TARGET_SIGNAL_REALTIME_32;
+ else if (64 <= hostsig && hostsig <= 127)
+ return (enum target_signal)
+ (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
+ }
+#endif
+
+ error ("Valgrind GDBSERVER bug: (target_signal_from_host):"
+ " unrecognized vki signal %d\n", hostsig);
return TARGET_SIGNAL_UNKNOWN;
}
static
int do_target_signal_to_host (enum target_signal oursig,
- int *oursig_ok)
+ int *oursig_ok)
{
*oursig_ok = 1;
switch (oursig) {
#endif
default:
+ {
+#if defined (VKI_SIGRTMIN)
+ int retsig = 0;
+
+ if (oursig >= TARGET_SIGNAL_REALTIME_33
+ && oursig <= TARGET_SIGNAL_REALTIME_63) {
+ /* This block of signals is continuous, and
+ TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
+ retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
+ } else if (oursig == TARGET_SIGNAL_REALTIME_32) {
+ /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
+ TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
+ retsig = 32;
+ } else if (oursig >= TARGET_SIGNAL_REALTIME_64
+ && oursig <= TARGET_SIGNAL_REALTIME_127) {
+ /* This block of signals is continuous, and
+ TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
+ retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
+ }
+
+ if (retsig >= VKI_SIGRTMIN && retsig < VKI_SIGRTMAX)
+ return retsig;
+ }
+#endif
+ error ("Valgrind GDBSERVER bug: (do_target_signal_to_host):"
+ " unrecognized target signal %d\n", oursig);
*oursig_ok = 0;
return 0;
}
starting ...
ok: 1st SIGALRM received
ok: 2nd SIGALRM received
+ok: SIGRTMIN received
target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-nlpasssigalrm
echo vgdb launched process attached\n
monitor v.set vgdb-error 999999
-break passsigalrm.c:43
-break passsigalrm.c:44
+# break on breakme++:
+break passsigalrm.c:48
+# break on the next line:
+break passsigalrm.c:50
#
#
# ensure SIGALRM can be passed directly to the process, without
# Tell the 2nd can be given directly
handle SIGALRM nostop noprint pass
continue
-# Here, we expect to stop on the breakme
+# Here, we expect to have stop on the breakme++
p breakme
continue
p breakme
+# now continue till the signal SIGRTMIN is encountered
+continue
+# and continue to deliver it
continue
quit
-Breakpoint 1 at 0x........: file passsigalrm.c, line 43.
-Breakpoint 2 at 0x........: file passsigalrm.c, line 44.
+Breakpoint 1 at 0x........: file passsigalrm.c, line 48.
+Breakpoint 2 at 0x........: file passsigalrm.c, line 50.
Signal Stop Print Pass to program Description
SIGALRM Yes Yes Yes Alarm clock
Continuing.
Signal Stop Print Pass to program Description
SIGALRM No No Yes Alarm clock
Continuing.
-Breakpoint 1, main (argc=1, argv=0x........) at passsigalrm.c:43
-43 breakme++;
+Breakpoint 1, main (argc=1, argv=0x........) at passsigalrm.c:48
+48 breakme++;
$1 = 0
Continuing.
-Breakpoint 2, main (argc=1, argv=0x........) at passsigalrm.c:44
-44 return 0;
+Breakpoint 2, main (argc=1, argv=0x........) at passsigalrm.c:50
+50 sa.sa_handler = sigrtmin_handler;
$2 = 1
Continuing.
+Program received signal SIG34, Real-time event 34.
+0x........ in syscall ...
+Continuing.
{
sigalrm_received++;
}
+static int sigrtmin_received = 0;
+static void sigrtmin_handler(int signr)
+{
+ sigrtmin_received++;
+}
static int breakme = 0;
system("../tests/true");
breakme++;
+
+ sa.sa_handler = sigrtmin_handler;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+
+ if (sigaction (SIGRTMIN, &sa, NULL) != 0)
+ perror("sigaction");
+ if (kill(getpid(), SIGRTMIN) != 0)
+ perror("kill sigrtmin");
+ if (sigrtmin_received == 1)
+ fprintf (stderr, "ok: SIGRTMIN received\n");
+ else
+ fprintf (stderr, "wrong sigrtmin: unexpected value %d sigrtmin_received\n",
+ sigrtmin_received);
return 0;
}