Subject: Re: segfault in completion for configure
From: Daniel Shahaf <[email-masked]>
To: Peter Stephenson <[email-masked]>
Cc: [email-masked]
Date: Thu, 17 Mar 2016 20:09:48 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Peter Stephenson wrote on Thu, Mar 17, 2016 at 18:24:06 +0000:
> Or is that if we know we've been int he signal handler at that point
> we already know the place where we needed to queue signals...

We could convert the pattern matching globals to macros that execute
code whenever the globals are accessed:

diff --git a/Src/pattern.c b/Src/pattern.c
index 72c7d97..a4fb24f 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -303,6 +303,12 @@ static long patalloc;              /* size allocated for same */
 static int patflags;               /* flags passed down to patcompile */
 static int patglobflags;  /* globbing flags & approx */
 
+#define patflags (f(), patflags)
+void f(void)
+{
+    /* ... */
+}
+
 /*
  * Increment pointer to metafied multibyte string.
  */

Now, f() can assert() some invariant, or check if SIGWINCH had been
delivered (and if so, drop into a gdb breakpoint), etc...

I'm proposing this just as a means of debugging for this one problem,
not as a permanent change.

Cheers,

Daniel