Skip to content

Commit

Permalink
Patch for supporting internal musl-libc signals in Alpine GDB
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahar Valiano committed Apr 11, 2019
1 parent 830e23d commit 0ca9c66
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
34 changes: 34 additions & 0 deletions gdb/common/signals.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion include/gdb/signals.def
Expand Up @@ -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.