Introducing G2.ai, the future of software buying.Try now

How do I set up a method to find out where my cpp program has encountered a segmentation fault without using breakpoints.

How do I set up a method to find out where my cpp program has encountered a segmentation fault without using breakpoints.
1 comment
Looks like you’re not logged in.
Users need to be logged in to answer questions
Log In
Brad C.
BC
Digerati / Chief Technology Officer
0
Breakpoints are great for stepping through your code line by line. If you need to find an exception, you need to add exception logging to your application. Then use Try/Catch logic to catch the exceptions and log them to a database, send an email, or some other logging method that you can use to go back and find out about the exception and what line of code caused it. A google search for Try/Catch Exception handling will help you. https://www.geeksforgeeks.org/exception-handling-c/ Additionally, you can find the segment fault in the stack trace. However it is common that your program will run without the fault locally, but experience it when released. Logging is paramount in assisting you in finding this.
Looks like you’re not logged in.
Users need to be logged in to write comments
Log In
Reply