On Sun, Jan 31, 2021 at 01:15:05PM -0500, Scott Mebust wrote:
> I don't know if this is an appropriate fix but I have found that if gdb is
> run in batch mode by gforth with -batch-silent instead of just with the -q
> quiet switch then gdb will exit even when the old ptrace capabilities are
> not re-enabled.

Thanks for pointing us in this direction.  The gdb's I have examined
have (documented) only -batch, not -batch-silent, but it works better
than -q.  The only shortcoming is that gdb does not produce an error
exit in this case, so Gforth does not fall back to producing a hex
dump, but that's probably not that useful anyway.

I have now applied this change to the Gforth (i.e., upstream) git head.

- anton

Here's the patch:
----------------------
diff --git a/dis-gdb.fs b/dis-gdb.fs
index 7ab88aa..04d0d85 100644
--- a/dis-gdb.fs
+++ b/dis-gdb.fs
@@ -59,9 +59,9 @@ set-current
         2drop ['] dump is discode
         addr u dump exit then
     [ e? os-type s" cygwin" str= ] [IF]
-       s\" \nset logging off\nquit\n\" >$file2 && gdb -nx -q -p `ps -p $$ | 
grep -v PPID | cut -c 10-17` -x $file2 2>/dev/null >/dev/null && rm $file2 && 
grep -v \"of assembler\" $file && rm $file"
+       s\" \nset logging off\nquit\n\" >$file2 && gdb -nx -batch -p `ps -p $$ 
| grep -v PPID | cut -c 10-17` -x $file2 2>/dev/null >/dev/null && rm $file2 && 
grep -v \"of assembler\" $file && rm $file"
     [ELSE]
-       s\" \nset logging off\nquit\n\" >$file2 && gdb -nx -q -p `ps -p $$ -o 
ppid=` -x $file2 2>/dev/null >/dev/null && rm $file2 && grep -v \"of 
assembler\" $file && rm $file"
+       s\" \nset logging off\nquit\n\" >$file2 && gdb -nx -batch -p `ps -p $$ 
-o ppid=` -x $file2 2>/dev/null >/dev/null && rm $file2 && grep -v \"of 
assembler\" $file && rm $file"
     [THEN]  append-extend-string
     2dup (system) 2swap drop free throw throw if
        addr u dump

Reply via email to