2

I try to comments 1.4K+ lines in a C++ function by using M-; or rectangle insert string //.

Wait for several minutes, Emacs still no respond. I have to kill Emacs.

In this case, how could I locate what cause the Emacs use 100% CPU and looks like do nothing?

Emacs: 25.0

OS: Ubuntu 14.04

Enze Chi
  • 1,410
  • 12
  • 28

1 Answers1

4

Little-known trick... You can send an interrupting debug signal to Emacs with kill/killall/pkill.

pkill -USR2 emacs

When sent to Emacs, the USR2 kill signal will interrupt whatever Emacs is doing and drop you to a debugger. From there, you can likely tell what is causing the hang from the stack trace.

Archenoth
  • 2,106
  • 16
  • 17