unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Added support for debugging emacs daemon
@ 2019-02-12 15:44 Michael Welsh Duggan
  2019-02-12 16:28 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Welsh Duggan @ 2019-02-12 15:44 UTC (permalink / raw)
  To: emacs-devel

I was recently in a position where I wanted to run "emacs --daemon"
under gdb.  After a few fumbles, I hit upon the following. I suggest
either adding this or something like this to .gdbinit or mentioning it
in DEBUG:

  # Follow forks until any possible daemonization is over
  set follow-fork-mode child
  tbreak init_signals
  commands
    set follow-fork-mode parent
  end

Mind you, init_signals is only used since it is the first emacs function
called after daemonization currently.  If things were to be moved
around, this snippet would have to change.

-- 
Michael Welsh Duggan
(mwd@cert.org)



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

* Re: Added support for debugging emacs daemon
  2019-02-12 15:44 Added support for debugging emacs daemon Michael Welsh Duggan
@ 2019-02-12 16:28 ` Eli Zaretskii
  2019-02-12 16:59   ` Michael Welsh Duggan
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2019-02-12 16:28 UTC (permalink / raw)
  To: Michael Welsh Duggan; +Cc: emacs-devel

> From: Michael Welsh Duggan <mwd@cert.org>
> Date: Tue, 12 Feb 2019 10:44:01 -0500
> 
> I was recently in a position where I wanted to run "emacs --daemon"
> under gdb.  After a few fumbles, I hit upon the following. I suggest
> either adding this or something like this to .gdbinit or mentioning it
> in DEBUG:
> 
>   # Follow forks until any possible daemonization is over
>   set follow-fork-mode child
>   tbreak init_signals
>   commands
>     set follow-fork-mode parent
>   end

Wouldn't this get in the way when debugging Emacs which launches
subprocesses?

It'd be OK to put this in etc/DEBUG, of course.  Patches welcome.

Thanks.



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

* Re: Added support for debugging emacs daemon
  2019-02-12 16:28 ` Eli Zaretskii
@ 2019-02-12 16:59   ` Michael Welsh Duggan
  2019-02-12 17:41     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Welsh Duggan @ 2019-02-12 16:59 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Michael Welsh Duggan <mwd@cert.org>
>> Date: Tue, 12 Feb 2019 10:44:01 -0500
>> 
>> I was recently in a position where I wanted to run "emacs --daemon"
>> under gdb.  After a few fumbles, I hit upon the following. I suggest
>> either adding this or something like this to .gdbinit or mentioning it
>> in DEBUG:
>> 
>>   # Follow forks until any possible daemonization is over
>>   set follow-fork-mode child
>>   tbreak init_signals
>>   commands
>>     set follow-fork-mode parent
>>   end
>
> Wouldn't this get in the way when debugging Emacs which launches
> subprocesses?

No.  That's why follow-fork-mode is turned back to parent after hitting
init_signals.

-- 
Michael Welsh Duggan
(mwd@cert.org)



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

* Re: Added support for debugging emacs daemon
  2019-02-12 16:59   ` Michael Welsh Duggan
@ 2019-02-12 17:41     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2019-02-12 17:41 UTC (permalink / raw)
  To: Michael Welsh Duggan; +Cc: emacs-devel

> From: Michael Welsh Duggan <mwd@cert.org>
> Date: Tue, 12 Feb 2019 11:59:15 -0500
> 
> >>   # Follow forks until any possible daemonization is over
> >>   set follow-fork-mode child
> >>   tbreak init_signals
> >>   commands
> >>     set follow-fork-mode parent
> >>   end
> >
> > Wouldn't this get in the way when debugging Emacs which launches
> > subprocesses?
> 
> No.  That's why follow-fork-mode is turned back to parent after hitting
> init_signals.

Right, sorry for not paying attention.



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

end of thread, other threads:[~2019-02-12 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-12 15:44 Added support for debugging emacs daemon Michael Welsh Duggan
2019-02-12 16:28 ` Eli Zaretskii
2019-02-12 16:59   ` Michael Welsh Duggan
2019-02-12 17:41     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).