GDB segfault.c Issue

91 views
Skip to first unread message

Trevor Bonas

unread,
Sep 9, 2020, 8:19:40 PM9/9/20
to cmpt-295-sfu

I compiled segfault.c as gcc -ggdb -g -o segfault segfault.c. It gave a warning, intentional I guess for the lab, and when I ran the executable (segfault) with cgdb it displayed the source file content in second window but output:
Reading symbols from segfault...done.
(gdb) run
warning: Cannot exec /usr/bin/zsh
warning:  -c
warning:  exec /home/family/Documents/Projects/C-Lab-1/segfault
warning: Error: No such file or directory

Starting program: /home/family/Documents/Projects/C-Lab-1/segfault
During startup program exited with code 127.

Note: I removed zsh because it was being annoying

So I couldn't get any of the things working like the lab1 video; I could set break points at the right spots but cgdb didn't stop at them during running the executable, and just output "exited with code 127" every time

Arrvindh Shriraman

unread,
Sep 9, 2020, 8:29:31 PM9/9/20
to cmpt-295-sfu
You seem to be running this locally on your machine "/home/family...."
As the error says it cannot find the executable and read the symbols so I would start there.

Trevor Bonas

unread,
Sep 9, 2020, 8:37:49 PM9/9/20
to cmpt-295-sfu
The files are all in my working directory
xx90.png

Arrvindh Shriraman

unread,
Sep 9, 2020, 9:07:07 PM9/9/20
to cmpt-295-sfu
Not sure; you seem to managing the VM on your own; hard for us to say unless we have all the details.

Trevor Bonas

unread,
Sep 9, 2020, 9:35:52 PM9/9/20
to cmpt-295-sfu
The solution was > sudo cgdb segfault. Works perfectly now.
Reply all
Reply to author
Forward
0 new messages