My Test program on AIX is
test.c
int myAixFunc (int *p);
int main (void)
{
printf("Hello,World\n");
int *p = 0; /* null pointer */
return myAixFunc(p);
}
int myAixFunc (int *p)
{
printf("Hello,World again\n");
*p = 2; /*Here I am trying to assign a value to the null pointer*/
printf("Hello,World again\n");
return 2;
}
> cc -o test -g test.c <-- Compiling the test.c
> ./test <-- Running the test and core dump is generated
Hello,World
Hello,World again
Segmentation fault(coredump)
> ls <-- core file generated
core test* test.c
> dbx test core <-- Start using the dbx tool to analyzing the core file Type 'help' for help. [using memory image in core] reading symbolic information ... Segmentation fault in myAixFunc at line 15 15 *p = 2; (dbx) where <-- call Stack
myAixFunc(p = (nil)), line 15 in "test.c"
main(), line 8 in "test.c"
(dbx) list
16 printf("Hello,World again\n");
17 return 2;
18 }
(dbx) dump myAixFunc
myAixFunc(p = (nil)), line 15 in "test.c"
__func__ = warning: Unable to access address 0x20000548 from core
" "
(dbx) quit
Related Analyzing core dumps in Unix
No comments:
Post a Comment