Jump to content
  • Advertisement
Sign in to follow this  
cocomo_guo

How to find the bug

This topic is 4842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
A debugger can very useful. If your app is crashing you can do a backtrace and examine the stack and heap to see where it crashed. If your bug is not segfaulting your app you can try stepping through your program line by line and examining the memory layout as you go. The first step is actually finding the faulty function. Once you know where its located then things should be easier.

Share this post


Link to post
Share on other sites
For compile errors, use the error messages to try to isolate the problem. They'll normally include a file which contains the error, and an approximate filename (the problem won't always be on the exact line listed). Depending on what IDE you're using, you probably have other debugging tools at your disposal to help solve these kinds of problems.

For things that compile fine but aren't behaving as expected, it can be much trickier to find where you went wrong. Try to reproduce the problem, and figure out what is effected. You then need to think about what could be causing the problem, and look through the relevant sections code. For example, if an object in your game was moving too fast, you would check the functions responsible for moving objects, and make sure everything is as it should be. You would also check the specific object (which may be defined as a class/struct/whatever) in order to make sure there is nothing wrong with it that is causing the problem.


If you're really having problems, you can always ask specifically on the forums and often someone else may be able to help you find the problem. If you decide to do this, make sure you:
- Don't post too many unrelated problems at once if you can.
- Post relevent sections of your code, using code (small sections of code) or source (larger sections of code) as appropriate, which you can read about in the FAQ if you need to.
- Describe the problem as best as you can.

Does that help you out at all?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!