This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Synthetic register related: Seg fault
- From: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- To: Andy Walker <ja_walker at earthlink dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 15 Jan 2003 19:49:43 +1100
- Subject: Re: Synthetic register related: Seg fault
- References: <E18Yi70-0001Th-00@grebe.mail.pas.earthlink.net>
On 15-Jan-2003, Andy Walker <ja_walker@earthlink.net> wrote:
> What would be the best approach to hunting down flaws that cause things like
> this Segmentation fault?
Configure GCC with --enable-checking.
Compile it with `-g' so that you can use gdb.
Compile your test case with `-v -da -Q'.
`-Q' will show which function in the test case is causing it to crash.
`-v' shows how `cc1' was invoked (useful for invoking cc1 manually in
gdb). `-da' dumps the RTL to a file after each stage.
Use gdb to get a stack trace.
Compile the compiler with debugging enabled (-g),
use the `-v' option to see how cc1 is getting invoked,
and then do
bash$ gdb cc1
gdb> run <arguments>
... (it will stop at the Seg fault)
gdb> where
...
gdb> list
Print out the values of interesting variables (e.g. the ones
in the statement which got a segmentation fault).
You can use the `pt' and `pr' macros from the gdbinit.in file to
display them. For example, if there is a value of type `tree' named
`t', and a value of type `rtx' named `r', you can use these commands:
gdb> source .gdbinit
gdb> print t
gdb> pt
gdb> print r
gdb> pr
gdb> pt
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.