Get the App
SLTechnology News&Howtos  ›  Development  › 

How to debug Segmentation fault by gdb

Shulou Source: shulou.com Published: 2022-06-02 11:14:38 10月03日 Update

This article mainly introduces gdb how to debug Segmentation fault, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

When debugging code with GCC, we may encounter the problem of Segmentation fault, so we need to debug with gdb.

1. Operation error

2. Use gdb to debug

Gcc-g-rdynamic trim.c (file to be compiled)

3. Gdb debugging

Gdb a.out

Just type r all the time to see the line number of the error.

Thank you for reading this article carefully. I hope the article "how to debug Segmentation fault in gdb" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles code value interests at the same time documents time more friends knowledge editing industry information information channels questions channels line numbers references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Linux vpn Docker