|
Segfaults for dummies |
|
Phlamethrower (22:37 2/6/2005) monkeyson2 (23:05 2/6/2005) Phlamethrower (23:14 2/6/2005) monkeyson2 (23:50 2/6/2005) Phlamethrower (23:57 2/6/2005) jmb (00:48 3/6/2005) Phlamethrower (01:10 3/6/2005) Phlamethrower (13:11 3/6/2005)
|
|
Jeffrey Lee |
Message #66313, posted by Phlamethrower at 22:37, 2/6/2005 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
If I've compiled a program for *nix using GCC and it's segfaulting, is there any easy command line switch I can use when compiling to make the error report give me some useful information? (e.g. the name of the function that's going wrong)
Or will I have to mess around with a seperate debugger? |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #66315, posted by monkeyson2 at 23:05, 2/6/2005, in reply to message #66313 |
Please don't let them make me be a monkey butler
Posts: 12380
|
-mpoke-function-name ? |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #66316, posted by Phlamethrower at 23:14, 2/6/2005, in reply to message #66315 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
cc1: error: invalid option `poke-function-name' |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #66317, posted by monkeyson2 at 23:50, 2/6/2005, in reply to message #66316 |
Please don't let them make me be a monkey butler
Posts: 12380
|
I guess that's a RISC OS only thing. You want it for Unix? According to the posting guidelines, you should bugger off and ask somewhere more appropriate
I'm afraid I can only suggest -g or significant amounts of printf now. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #66318, posted by Phlamethrower at 23:57, 2/6/2005, in reply to message #66317 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Baaaah!
Would be OK if it crashed when compiled for RISC OS |
|
[ Log in to reply ] |
|
JMB |
Message #66319, posted by jmb at 00:48, 3/6/2005, in reply to message #66318 |
Member
Posts: 467
|
The correct answer is:
$ gcc -g foo.c -o foo
$ gdb ./foo
(gdb) run
***SEGV***
(gdb) bt
The other tool you'll want to investigate is valgrind, which is the best debugging tool EVAR! |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #66320, posted by Phlamethrower at 01:10, 3/6/2005, in reply to message #66319 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
ok, thanks
*sits around waiting for cygwin to update* |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #66393, posted by Phlamethrower at 13:11, 3/6/2005, in reply to message #66320 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Tsk, pesky strings getting placed in read only segments! |
|
[ Log in to reply ] |
|
|