LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   core-dumped (https://www.linuxquestions.org/questions/programming-9/core-dumped-594502/)

dayalan_cse 10-25-2007 09:19 AM

core-dumped
 
Hello,

I have question about core-dump. for eample in simple C code i am declaring a pointer but it doesnt have any pointe ( no address has been pointed to the pointer) in that case if i dereference the pointer variable i will get code-dump. In simple C code we can find the place where is core-dump and which line code-dumped but incase of bigger projects and all, how to find these kind of dereference of unallocated pointers or not assigned a valid address to the pointer.

Can anybody suggest how to find the pointer variables which is not allocated any valid address but it has been dereference some where in the code.

Thanks in advance.

Thanks,
Dayalan

Mara 10-27-2007 03:41 PM

Exactly the same way. You are able to find the point of code where it crashed. Then there's an action performed on some pointer. From that point it's easy.

On the other hand, it's much better to try to prevent such situations: when you declare a pointer, always set it to NULL and when you free() one, set it to NULL again.

mudd1 10-28-2007 03:32 AM

Quote:

Originally Posted by dayalan_cse (Post 2936405)
Can anybody suggest how to find the pointer variables which is not allocated any valid address but it has been dereference some where in the code.

ddd is a nice debugger (it's a gdb frontend) in case you don't know it yet. It answers a lot of questions by itself.


All times are GMT -5. The time now is 04:19 PM.