Re: I'm a beginner and need help about "Segmentation fault" error.

Simon Marchi <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 2020-11-03 11:54 a.m., Jason Long via Gdb wrote:
> Hello,
> I'm using Debian 10.6 x86_64 and when I want to run a program then it show me "Segmentation fault" error.
> How can use gdb to find the reason of it?
> I used strace to generate an output and posted it here: https://pastebin.fun/NY4RUEmyzO
>
> I'm thankful if anyone advice me step by step.
>
> Thank you.
>

Hi Jason,

In its most simple expressioj, just load the program in GDB:

  $ gdb <program>

and run it:

  (gdb) run

If the program crashes (receives a SIGSEGV / segmentation fault signal),
it will stop and you'll be able to inspect the state of the program at
that moment.  For example, you'll be able to use the "backtrace" command
to get an idea of wherwe the program was.

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.