Subject: Re: bug#14569: 24.3.50; bootstrap fails on Cygwin

From: Eli Zaretskii <[email-masked]>
Date: Tue, 18 Jun 2013 18:53:51 +0300

> Date: Mon, 17 Jun 2013 16:15:33 -0400
> From: Ken Brown <[email-masked]>
> CC: Jan Djärv <[email-masked]>, [email-masked]
> 
> >    emacsdbg = EMACSLOADPATH=$(lisp) LC_ALL=C gdb --batch-silent --return-child-result -ex 'b abort' -ex run --args $(EMACS) $(EMACSOPT)
> 
> This causes gdb to exit, whether or not the breakpoint was hit, without 
> giving the user a chance to get a backtrace.  I tried adding
> 
>    -x $(lisp)/commands.txt
> 
> where commands.txt contains
> 
>    commands
>    bt
>    end
> 
> but that didn't work.  gdb still exited (with an error) when 
> compile-onefile failed, but it didn't print a backtrace first.  There 
> has to be a way to get a backtrace when gdb runs in batch mode.  Do you 
> know how, Eli?

Sorry, I went overboard with --batch-silent, please use --batch
instead.  (--batch-silent prevents the backtrace from showing up.)

As for displaying the backtrace, just add the "bt" command to the
chain, like this:

  emacsdbg = EMACSLOADPATH=$(lisp) LC_ALL=C gdb --batch --return-child-result -ex 'b abort' -ex run -ex bt -ex cont --args $(EMACS) $(EMACSOPT)

GDB executes the commands given via -ex in order, so think of this as
if you typed the commands whenever GDB shows its prompt.

Note that I also added "continue", to let Emacs exit abnormally after
hitting the breakpoint (or a segfault).  When neither the breakpoint
nor a fatal signal fire, GDB will say "No stack." when Emacs exits
normally, but that's harmless.