Juniper Networks Interview Question
Software Engineer / DevelopersLittle too subjective a question to answer
in my experience I never knew where the corruption was until it really made a mess ( a crash ), some times used to get core files with a little bit of stack trace and sometimes ( most occasions where I used to bang my head ) just core with absolutely no stack trace what so ever
and this is what it looks like
??
??
??
any way selection of frames in the core and printing the values carefully gives certain Idea on corrupted values but really what caused the corruption is again a mystery, solution of which depends on quite a few other factors like
reproducing the corrupt memory in test lab
using valgrind for better leak detection (a really good tool when it comes to identifying the corruptions)
most importantly read the code
suddenly i thought my answer is quite out of topic so here is a quick answer
we can see the corruption after the program actually corrupted by using print in gdb which probably say <invalid memory address>
P.S - use valgrind first and then if program crashes then gdb there is no gdb without crash
If the corruption was a wild value, I would most likely set a watch point which would watch stop the program for values outside what I considered a normal range for values in the structure.
- Anonymous May 04, 2010