Configure GCC with
--enable-checking. Compile it with
-g -O0 so that you can use
Compile your test case with
-v -da -Q.
-Qwill show which function in the test case is causing it to crash.
cc1was invoked (useful for invoking
-dadumps the RTL to a file after each stage.
gdb to get a stack trace:
bash$ gdb cc1 gdb> run arguments (cc1 will stop at the segmentation fault) gdb> where gdb> list
Print out the values of interesting variables, e.g., the ones in
the statement which got the segmentation fault.
You can use the
pr macros from the
gdbinit.in file to display GCC data. For example, if
there is a value of type
a value of type
r, you can use
gdb> source .gdbinit gdb> print t gdb> pt gdb> print r gdb> pr gdb> pt
Copyright (C) Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
These pages are maintained by the GCC team. Last modified 2022-10-26.