Let’s assume you have a program that just crashed and you have a core dump. You can enable core dumps by using the ulimit -c unlimited command.
If you want to analyze what happened, here are some steps you can follow:
//This will switch the disassembly listing to intel format.
(gdb) set disassembly-flavor intel
//To view the stack trace and see where the program crashed.
(gdb) bt full
//To disassemble the instructions around the address where the crash happened.
(gdb) disas 0x<addr>
//To view register values
(gdb) i r
Enjoy 🙂