How to debug a g++ segmentation fault using gdb? : <p>I got a segfault when running my program. Then I googled my question and tried to follow steps from <a href="https://www.gnu.org/software/gcc/bugs/segfault.html" rel="nofollow noreferrer">https://www.gnu.org/software/gcc/bugs/segfault.html</a>.</p>

<p>I did not configure GCC with <code>--enable-checking</code> then my first question is - </p>

<p>1) is it necessary to configure it and compile with <code>-v -da -Q</code> ?</p>

<p>But I always do compile with flags such as <code>-g -o0</code>. After running the program in GDB with arguments I get this:</p>

<p><a href="https://i.stack.imgur.com/EMdFw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EMdFw.png" alt="gdb_screenshot"></a></p>

<p>2) I can not print variables after segfault, is it okay ?</p>

<p>3) How to figure out the line of my source code where segfault happens ?</p>
