How to debug segmentation fault?

前端 未结 4 1113
我在风中等你
我在风中等你 2020-12-16 08:33

It works when, in the loop, I set every element to 0 or to entry_count-1. It works when I set it up so that entry_count is small, and I write it by hand instead of by loop (

4条回答
  •  隐瞒了意图╮
    2020-12-16 09:18

    Valgrind and GDB are very useful.

    The most previous one that I used was GDB- I like it because it showed me the exact line number that the Segmentation Fault was on.

    Here are some resources that can guide you on using GDB:

    GDB Tutorial 1

    GDB Tutorial 2

    If you still cannot figure out how to use GDB with these tutorials, there are tons on Google! Just search debugging Segmentation Faults with GDB!

    Good luck :)

提交回复
热议问题