[review v4] Add RAII class for blocking gdb signals

Tom Tromey (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Tue Nov 26 16:53:00 GMT 2019


Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/168
......................................................................


Patch Set 4:

(1 comment)

I'll zap the comment again, unless you want to reword it yourself somehow.

I assume you meant to +2 this one?

| --- /dev/null
| +++ gdb/gdbsupport/block-signals.h
| @@ -1,0 +34,19 @@ public:
| +  block_signals ()
| +  {
| +#ifdef HAVE_PTHREAD_SIGMASK
| +    sigset_t mask;
| +    sigemptyset (&mask);
| +    sigaddset (&mask, SIGINT);
| +    sigaddset (&mask, SIGCHLD);
| +    sigaddset (&mask, SIGALRM);
| +    sigaddset (&mask, SIGWINCH);
| +    pthread_sigmask (SIG_BLOCK, &mask, &m_old_mask);

PS3, Line 43:

> I actually wondered whether this should block all signals instead of just blocking a subset -- I was pondering whether the set of signals might be target backend specific, for example.  But we can leave that for if/when we need it.

I think the Boehm GC needs some signal (or signals?) to be deliverable
in order to suspend threads.

| +#endif
| +  }
| +
| +  ~block_signals ()
| +  {
| +#ifdef HAVE_PTHREAD_SIGMASK
| +    pthread_sigmask (SIG_SETMASK, &m_old_mask, nullptr);
| +#endif
| +  }

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: If3f37dc57dd859c226e9e4d79458a0514746e8c6
Gerrit-Change-Number: 168
Gerrit-PatchSet: 4
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Tue, 26 Nov 2019 16:53:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Pedro Alves <palves@redhat.com>
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: comment



More information about the Gdb-patches mailing list