+2021-06-05 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * compile/compile.c (scoped_ignore_sigpipe): New helper class.
+ (compile_to_object): Ignore SIGPIPE before calling the plugin.
+
2021-06-05 Tom Tromey <tom@tromey.com>
* data-directory/Makefile.in (Makefile): Use correct directory
fputs_filtered (message, gdb_stderr);
}
+/* RAII class used to ignore SIGPIPE in a scope. */
+
+class scoped_ignore_sigpipe
+{
+public:
+ scoped_ignore_sigpipe ()
+ {
+#ifdef SIGPIPE
+ m_osigpipe = signal (SIGPIPE, SIG_IGN);
+#endif
+ }
+
+ ~scoped_ignore_sigpipe ()
+ {
+#ifdef SIGPIPE
+ signal (SIGPIPE, m_osigpipe);
+#endif
+ }
+
+ DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigpipe);
+
+private:
+#ifdef SIGPIPE
+ sighandler_t m_osigpipe = NULL;
+#endif
+};
+
/* Process the compilation request. On success it returns the object
and source file names. On an error condition, error () is
called. */
fprintf_unfiltered (gdb_stdlog, "source file produced: %s\n\n",
fnames.source_file ());
+ /* If we don't do this, then GDB simply exits
+ when the compiler dies. */
+ scoped_ignore_sigpipe ignore_sigpipe;
+
/* Call the compiler and start the compilation process. */
compiler->set_source_file (fnames.source_file ());
ok = compiler->compile (fnames.object_file (), compile_debug);