Hello everyone,
I'm trying to learn to use gdb v5.3-25mdk (Mandrake Linux).
I wrote a test.c file according to instructions I found in "Sam's Teach Youself
Linux Programming in 24 Hours"
The test.c code is supposed to compile but produce a segmentation fault upon
execution (which it does) as well as a core file (which I don't think it does).
No core file is produced (that I can find with either ls or ls -a)???
Here's the code:
Code:
static void fun1(void) {
char *cp = 0;
*cp = '!'; /*intentional bad dereference to produce segmentation fault*/
}
int main (int argc,char **argv) {
fun1( );
return 0;
}
The command for compiling is: bash$ gcc -g -D_GNU_SOURCE test.c -o test
It compiles without error or warning.
From bash$ ./test, I get "Segmentation fault".
No core file.
I ran bash$ gdb ./test core
gdb tells me "/dir/dir/core no such file or directory"
Have things changed for gdb since the book was published in 1999?
Thanks