all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to debug/gdb emacs/runemacs in windows?
@ 2019-05-23  8:15 Shuguang Sun
  2019-05-23 14:13 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Shuguang Sun @ 2019-05-23  8:15 UTC (permalink / raw
  To: help-gnu-emacs

Hi all,

My emacs (pdumper) crashes for some commands, and I'd like to do some
debug/gdb to find more information.

First, I run gdb in msys2/mingw64:
--8<---------------cut here---------------start------------->8---
# gdb emacs
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from emacs...
(gdb) run --dump-file "c:/Users/username/HOME/.emacs.d/var/dumps/semacs.pdmp" --force-dump
Starting program: C:\Users\username\emacs\bin\emacs.exe --dump-file "c:/Users/username/HOME/.emacs.d/var/dumps/semacs.pdmp" --force-dump
[New Thread 231988.0x38e2c]
[New Thread 231988.0x3ea30]
[New Thread 231988.0x3d88c]
[Thread 231988.0x38e2c exited with code 0]
[Thread 231988.0x3ea30 exited with code 0]
[Thread 231988.0x3d88c exited with code 0]
[New Thread 231988.0x3b6c4]
[New Thread 231988.0x35dd0]
[New Thread 231988.0x3bb88]
[Thread 231988.0x3bb88 exited with code 1]
[New Thread 231988.0x22c0]
[Thread 231988.0x22c0 exited with code 1]

Thread 1 received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
--8<---------------cut here---------------end--------------->8---

The error above is because I call `recentf-edit-list` in the pdumper
emacs which make it crash. Then

--8<---------------cut here---------------start------------->8---
(gdb) thread 1
[Switching to thread 1 (Thread 231988.0x3954c)]
#0  0x0000000000000000 in ?? ()
(gdb) backtrace
#0  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
--8<---------------cut here---------------end--------------->8---

How could I find more information?



-- 
Best Regards
Shuguang Sun




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to debug/gdb emacs/runemacs in windows?
  2019-05-23  8:15 How to debug/gdb emacs/runemacs in windows? Shuguang Sun
@ 2019-05-23 14:13 ` Eli Zaretskii
  2019-05-24  1:26   ` Shuguang Sun
  2019-05-27  9:37   ` Shuguang Sun
  0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2019-05-23 14:13 UTC (permalink / raw
  To: help-gnu-emacs

> From: Shuguang Sun <shuguang79@qq.com>
> Date: Thu, 23 May 2019 16:15:56 +0800
> 
> (gdb) run --dump-file "c:/Users/username/HOME/.emacs.d/var/dumps/semacs.pdmp" --force-dump
> Starting program: C:\Users\username\emacs\bin\emacs.exe --dump-file "c:/Users/username/HOME/.emacs.d/var/dumps/semacs.pdmp" --force-dump

What is the --force-dump option?  I don't think we have it in Emacs.

> Thread 1 received signal SIGSEGV, Segmentation fault.
> 0x0000000000000000 in ?? ()
> --8<---------------cut here---------------end--------------->8---
> 
> The error above is because I call `recentf-edit-list` in the pdumper
> emacs which make it crash. Then
> 
> --8<---------------cut here---------------start------------->8---
> (gdb) thread 1
> [Switching to thread 1 (Thread 231988.0x3954c)]
> #0  0x0000000000000000 in ?? ()
> (gdb) backtrace
> #0  0x0000000000000000 in ?? ()
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
> --8<---------------cut here---------------end--------------->8---
> 
> How could I find more information?

Looks like your stack is smashed.  Could it be you have infinite
recursion?

One thing to try is to load the src/.gdbinit file from the Emacs
distribution before you issue the "run" command, it might help you by
stopping Emacs earlier, before it does something that destroys the
stack.  If that doesn't work, put a breakpoint inside some function
that recentf-edit-list calls, like Fformat perhaps, invoke
recentf-edit-list, then step through the code until you see where it
crashes.

(The above is based on incomplete information, because you didn't
explain how recentf-edit-list is called, and what exactly is in your
private pdumper file.)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to debug/gdb emacs/runemacs in windows?
  2019-05-23 14:13 ` Eli Zaretskii
@ 2019-05-24  1:26   ` Shuguang Sun
  2019-05-24  4:43     ` Shuguang Sun
  2019-05-27  9:37   ` Shuguang Sun
  1 sibling, 1 reply; 5+ messages in thread
From: Shuguang Sun @ 2019-05-24  1:26 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Shuguang Sun <shuguang79@qq.com>
>> Date: Thu, 23 May 2019 16:15:56 +0800
>> 
>> (gdb) run --dump-file "c:/Users/username/HOME/.emacs.d/var/dumps/semacs.pdmp" --force-dump
>> Starting program: C:\Users\username\emacs\bin\emacs.exe --dump-file
>> "c:/Users/username/HOME/.emacs.d/var/dumps/semacs.pdmp" --force-dump
>
> What is the --force-dump option?  I don't think we have it in Emacs.
>

The --force-dump option is speficed in my dot emacs. It helps to skip
requiring some libraries or evaluating some piece of code in case of
dumpted emacs which has been evaluted during dumping, but not in normal
emacs.

--8<---------------cut here---------------start------------->8---
(defun --my-parse-command-line (args)
  "Handle specific command line arguments."
  (let ((i 0) new-args)
    (while (< i (length args))
      (let ((arg (nth i args))
            (next-arg-digit
             (when (< (1+ i) (length args))
               (string-to-number (nth (1+ i) args)))))
        (when (or (null next-arg-digit) (= 0 next-arg-digit))
          (setq next-arg-digit nil))
        (pcase arg
          ("--force-dump"
           (setq --is-not-dumped nil))
          (_ (push arg new-args))))
      (setq i (1+ i)))
    (nreverse new-args)))

(setq command-line-args (--my-parse-command-line command-line-args))
--8<---------------cut here---------------end--------------->8---


>> 
>> How could I find more information?
>
>
> One thing to try is to load the src/.gdbinit file from the Emacs
> distribution before you issue the "run" command, it might help you by
> stopping Emacs earlier, before it does something that destroys the
> stack.  If that doesn't work, put a breakpoint inside some function
> that recentf-edit-list calls, like Fformat perhaps, invoke
> recentf-edit-list, then step through the code until you see where it
> crashes.
>
> (The above is based on incomplete information, because you didn't
> explain how recentf-edit-list is called, and what exactly is in your
> private pdumper file.)
>
>

Thanks for your patient and helpful reply. I'll try it later.



-- 
Best Regards
Shuguang Sun





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to debug/gdb emacs/runemacs in windows?
  2019-05-24  1:26   ` Shuguang Sun
@ 2019-05-24  4:43     ` Shuguang Sun
  0 siblings, 0 replies; 5+ messages in thread
From: Shuguang Sun @ 2019-05-24  4:43 UTC (permalink / raw
  To: help-gnu-emacs

Shuguang Sun <shuguang79@qq.com> writes:

> The --force-dump option is speficed in my dot emacs. It helps to skip
> requiring some libraries or evaluating some piece of code in case of
> dumpted emacs which has been evaluted during dumping, but not in normal
> emacs.
>
> (defun --my-parse-command-line (args)
>   "Handle specific command line arguments."
>   (let ((i 0) new-args)
>     (while (< i (length args))
>       (let ((arg (nth i args))
>             (next-arg-digit
>              (when (< (1+ i) (length args))
>                (string-to-number (nth (1+ i) args)))))
>         (when (or (null next-arg-digit) (= 0 next-arg-digit))
>           (setq next-arg-digit nil))
>         (pcase arg
>           ("--force-dump"
>            (setq --is-not-dumped nil))
>           (_ (push arg new-args))))
>       (setq i (1+ i)))
>     (nreverse new-args)))
>
> (setq command-line-args (--my-parse-command-line command-line-args))
>
>
It is learned from Spacemacs.

-- 
Best Regards
Shuguang Sun





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to debug/gdb emacs/runemacs in windows?
  2019-05-23 14:13 ` Eli Zaretskii
  2019-05-24  1:26   ` Shuguang Sun
@ 2019-05-27  9:37   ` Shuguang Sun
  1 sibling, 0 replies; 5+ messages in thread
From: Shuguang Sun @ 2019-05-27  9:37 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>
> One thing to try is to load the src/.gdbinit file from the Emacs
> distribution before you issue the "run" command, it might help you by
> stopping Emacs earlier, before it does something that destroys the
> stack.  If that doesn't work, put a breakpoint inside some function
> that recentf-edit-list calls, like Fformat perhaps, invoke
> recentf-edit-list, then step through the code until you see where it
> crashes.
>
> (The above is based on incomplete information, because you didn't
> explain how recentf-edit-list is called, and what exactly is in your
> private pdumper file.)
>
>

Thanks. It is really help me. I tried to use edebug (edebug-defun) to
find the issue which is rooted to recentf-dialog-goto-first. Finally
with carefully investigate the dump initiate file, it is found the
(require 'ein-org) triggered the issue. And also the issue of crash when
custumize-group faces.

It may not related to emacs itself. 

-- 
Best Regards
Shuguang Sun





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-27  9:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-23  8:15 How to debug/gdb emacs/runemacs in windows? Shuguang Sun
2019-05-23 14:13 ` Eli Zaretskii
2019-05-24  1:26   ` Shuguang Sun
2019-05-24  4:43     ` Shuguang Sun
2019-05-27  9:37   ` Shuguang Sun

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.