When to use the assembly to debug a c/c++ program?
Does it help to learn some assembly to debug programs?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It can be very helpful in cases where you can not (yet) reliably reproduce a
bug, such as due to heap/stack corruption. You might get one or two core
dumps, quite possibly from a customer. Even assuming your debugger is
reliable, looking at assembly can tell you exactly which instruction is
crashing (and thus which piece of memory is corrupted).
Furthermore, in my experience (primarily in kernel debugging) the debuggers
have been relatively bad at dealing with optimized code. They get things like
parameters/etc wrong, and to really tell what’s going on I need to look at
diassembly.
If I can reproduce a problem reliably/easily it doesn’t tend to be as helpful
to deal with disassembly, because I’ll get more information from just stepping
through the program. On the other hand, getting to the point where you can
reproduce a problem is usually more than halfway to fixing it.