Throw stack trace from program kill
Ali Çehreli
acehreli at yahoo.com
Sun Jan 16 16:36:09 UTC 2022
On 1/16/22 07:15, Hipreme wrote:
> Is there some way to throw a stack trace when killing the program from
> the CTRL+C from the terminal?
I am interested in how to add Ctrl+C support for a D program as well.
> It would help a lot into debugging occasional infinity loops
One way of achieving that is starting the program in a debugger. For
example, with gdb:
$ gdb --args ./my_program its_command_line_arguments
[ ... gdb prints some information ... ]
(gdb) run
[ ... gdb starts the program ... ]
Press Ctrl+C here to see the backtrace.
Aside, this method is the easiest way of profiling a program to
determine where it's spending most of its time.
Ali
More information about the Digitalmars-d-learn
mailing list