www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2009/09/09/03:35:08

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Message-ID: <4AA75A7C.3000505@iki.fi>
Date: Wed, 09 Sep 2009 10:34:20 +0300
From: Saunalahti <andris DOT pavenis AT iki DOT fi>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fi; rv:1.9.1.1) Gecko/20090715 Thunderbird/3.0b3
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Building latest GDB snapshots
References: <83hbvj80ht DOT fsf AT gnu DOT org> <93c172b50909040715n791c007ema4715db95e946e2e AT mail DOT gmail DOT com>
In-Reply-To: <93c172b50909040715n791c007ema4715db95e946e2e@mail.gmail.com>
Reply-To: djgpp-workers AT delorie DOT com

This is a multi-part message in MIME format.
--------------070107010902040401030809
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

4.9.2009 17:15, Rugxulo kirjoitti:
> Hi,    :-)
>
> On Fri, Sep 4, 2009 at 5:31 AM, Eli Zaretskii<eliz AT gnu DOT org>  wrote:
>    
>> Can someone build the latest GDB CVS snapshots with DJGPP?
>>      
>
> Wow, you sound exasperated! Yes, it's a very annoying bug, and
> apparently it's existed since 2004 (hi, Gordon!). No fix yet (Bash
> source is confusing!), but we do mostly know where the problem lies.
>
> http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp/2006/08/08/16:37:27
> http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp/2006/08/20/11:54:36
> http://lists.gnu.org/archive/html/bug-autoconf/2009-08/msg00066.html
>
> For now, I suggest the wonderful workaround of putting "( " and " )"
> around the "return $ac_retval" portions. That seems to make it work
> for DJGPP Bash, at least. (I guess you didn't notice my similar issue
> when ZILE upgraded to AutoConf 2.64, heh.)
>
>    
I have not tested with development version of GDB, but could You try 
attached patch for DJGPP port
of bash-2.0.5b. It seems to fix problem mentioned in these old messages.

The problem was with longjmp() after return from procedure which saved 
state using setjmp().

Andris.


--------------070107010902040401030809
Content-Type: text/plain;
 name="b205br3.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="b205br3.diff"

--- bash-2.05b/nofork.c.xx	2009-09-09 09:29:28 +0000
+++ bash-2.05b/nofork.c	2009-09-09 10:20:14 +0000
@@ -27,6 +27,7 @@
 #include "builtins/common.h"
 #include "hashcmd.h"
 #include "flags.h"
+#include "bashjmp.h"
 
 #define SAVESTRING(p)  ((p != NULL) ? savestring (p) : NULL)
 #define FREE_AND_CLEAR(p)  (free (p), p = NULL)
@@ -259,9 +260,15 @@
   maybe_make_export_env ();
 }
 
+extern int return_catch_flag;
+extern int return_catch_value;
+
 int
 nofork_save_all_environment (OLDENVBUF *envp)
 {
+  save_jmp_buf (envp->return_catch, return_catch);
+  envp->return_catch_flag = return_catch_flag;
+  envp->return_catch_value = return_catch_value;
   save_jmp_buf (envp->top_level, top_level);
   save_jmp_buf (envp->subshell_top_level, subshell_top_level);
   nofork_save_std_fds (envp->fds);
@@ -285,6 +292,10 @@
   restore_jmp_buf (envp->top_level, top_level);
   restore_jmp_buf (envp->subshell_top_level, subshell_top_level);
 
+  restore_jmp_buf (envp->return_catch, return_catch);
+  return_catch_flag = envp->return_catch_flag;
+  return_catch_value = envp->return_catch_value;
+
   current_environment = envp->prev_environment;
 
   return 0;
--- bash-2.05b/nofork.h.xx	2009-09-09 09:29:34 +0000
+++ bash-2.05b/nofork.h	2009-09-09 09:33:28 +0000
@@ -18,6 +18,10 @@
   jmp_buf top_level;
   jmp_buf subshell_top_level;
 
+  int return_catch_flag;
+  int return_catch_value;
+  jmp_buf return_catch;
+
   VAR_CONTEXT *global_variables;
   VAR_CONTEXT *shell_variables;
   HASH_TABLE *shell_functions;
@@ -50,6 +54,8 @@
 
   struct oldenvbuf *prev_environment;
 
+  int saved;
+  int restored;
 } OLDENVBUF;
 
 typedef struct
--- bash-2.05b/subst.c.xx	2002-07-19 01:23:30 +0000
+++ bash-2.05b/subst.c	2009-09-09 09:51:38 +0000
@@ -3828,6 +3828,7 @@
   if (pid < 0)
     {
       sys_error ("cannot make child for command substitution");
+      nofork_restore_all_environment (&oldenvbuf);
     error_exit:
 
       FREE (istring);
@@ -3892,6 +3893,13 @@
 	 so we don't go back up to main (). */
       result = setjmp (top_level);
 
+#if !defined(HAVE_WORKING_FORK)
+      /* return_catch and return_catch_flag will be restored
+	 after call to nofork_restore_all_environment(). */
+      if (result == 0)
+	return_catch_flag = 0;
+#endif
+
       /* If we're running a command substitution inside a shell function,
 	 trap `return' so we don't return from the function in the subshell
 	 and go off to never-never land. */

--------------070107010902040401030809--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019