Skip to content
Permalink
Browse files

Patch for supporting internal musl-libc signals in Alpine GDB

  • Loading branch information...
shaharv committed Apr 11, 2019
1 parent 830e23d commit 0ca9c66889bdc9558622a92f96a86552fa701924
Showing with 38 additions and 1 deletion.
  1. +34 −0 gdb/common/signals.c
  2. +4 −1 include/gdb/signals.def
@@ -23,6 +23,21 @@
#include <signal.h>
#endif

/* Hack for supporting internal musl-libc signals, defined in:
http://git.musl-libc.org/cgit/musl/tree/src/internal/pthread_impl.h */

#ifndef SIGTIMER
#define SIGTIMER 32
#endif

#ifndef SIGCANCEL
#define SIGCANCEL 33
#endif

#ifndef SIGSYNCCALL
#define SIGSYNCCALL 34
#endif

#include "gdb_signals.h"

struct gdbarch;
@@ -104,6 +119,7 @@ gdb_signal_from_name (const char *name)
if (signals[sig].name != NULL
&& strcmp (name, signals[sig].name) == 0)
return sig;

return GDB_SIGNAL_UNKNOWN;
}

@@ -336,6 +352,15 @@ gdb_signal_from_host (int hostsig)
return GDB_SIGNAL_LIBRT;
#endif

#if defined (SIGTIMER)
if (hostsig == SIGTIMER)
return GDB_SIGNAL_TIMER;
#endif
#if defined (SIGSYNCCALL)
if (hostsig == SIGSYNCCALL)
return GDB_SIGNAL_SYNCCALL;
#endif

#if defined (REALTIME_LO)
if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
{
@@ -593,6 +618,15 @@ do_gdb_signal_to_host (enum gdb_signal oursig,
return SIGLIBRT;
#endif

#if defined (SIGTIMER)
case GDB_SIGNAL_TIMER:
return SIGTIMER;
#endif
#if defined (SIGSYNCCALL)
case GDB_SIGNAL_SYNCCALL:
return SIGSYNCCALL;
#endif

default:
#if defined (REALTIME_LO)
retsig = 0;
@@ -196,7 +196,10 @@ SET (GDB_EXC_BREAKPOINT, 150, "EXC_BREAKPOINT", "Breakpoint")

SET (GDB_SIGNAL_LIBRT, 151, "SIGLIBRT", "librt internal signal")

SET (GDB_SIGNAL_TIMER, 152, "SIGTIMER", "SIGTIMER")
SET (GDB_SIGNAL_SYNCCALL, 153, "SIGSYNCCALL", "SIGSYNCCALL")

/* If you are adding a new signal, add it just above this comment. */

/* Last and unused enum value, for sizing arrays, etc. */
SET (GDB_SIGNAL_LAST, 152, NULL, "GDB_SIGNAL_LAST")
SET (GDB_SIGNAL_LAST, 154, NULL, "GDB_SIGNAL_LAST")

0 comments on commit 0ca9c66

Please sign in to comment.
You can’t perform that action at this time.