-
Hello All, Just wanted to know how can we proceed to debug
Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Just print the input and flush stdout so it will print before the crash. This way, you can see the input causing your code to crash and proceed from there. |
Beta Was this translation helpful? Give feedback.
-
When I face a crash in a C or C++ solution, my procedure usually is:
If all above fails, this is where the fun begins :) |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
Thanks @hobovsky & @BobtheLantern for your answers. @hobovsky thanks for marking that AI comment as spam. |
Beta Was this translation helpful? Give feedback.
When I face a crash in a C or C++ solution, my procedure usually is:
SIGFPE
usually means division by 0, modulo by 0, or domain error (like a negative argument tosqrt
or logarithm). Signal6
usually means invalid call tofree
: calling it on a string literal, or on a moved pointer. There is a chance you returned an invalid pointer which cannot be freed.SIGSEGV
is the most problematic because it can mean anything related to invalid handling of memory, but the first thing to check is usually an out-of-bounds access to arrays or strings.printf
orstd::cout
to print out the input causing my crash. It i…