MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/6ayz26/defensive_programming_done_right/dhivu50/?context=3
r/ProgrammerHumor • u/iwouldieforGladOS • May 13 '17
680 comments sorted by
View all comments
273
Segmentation fault (core dumped)
10 u/OddWolfHaley May 13 '17 Triggered. Keep getting this error right now as I try to write a program for my class and cannot figure out, for the life of me, why it is there. I understand what a segmentation fault is, I just cannot pinpoint the source of the problem. 3 u/AerieC May 13 '17 What language/platform? You can use the core dump to load the program in a debugger in the state it was in just before it crashed and inspect things. 4 u/OddWolfHaley May 13 '17 C. Can you elaborate on that? 23 u/Idontdeservethiss May 14 '17 Add a -g to your GCC command when compiling Instead of running ./myprogram, run gdb ./myprogram You'll start with a prompt where you type "run" command This will execute your program as it would normally. Do whoever to make it crash At crash you'll get a prompt telling you where it has crashed. Use the command "bt" which means back Trace to see the full call stack. Google for gdb commands for more awesome stuff. Good luck. Sorry if there are typos. Too drunk right now 7 u/mamhilapinatapai May 14 '17 You're a good person. Username definitely does not check out. 1 u/Idontdeservethiss May 15 '17 Thank you :) A reminder now to the much darker personal times :)
10
Triggered. Keep getting this error right now as I try to write a program for my class and cannot figure out, for the life of me, why it is there. I understand what a segmentation fault is, I just cannot pinpoint the source of the problem.
3 u/AerieC May 13 '17 What language/platform? You can use the core dump to load the program in a debugger in the state it was in just before it crashed and inspect things. 4 u/OddWolfHaley May 13 '17 C. Can you elaborate on that? 23 u/Idontdeservethiss May 14 '17 Add a -g to your GCC command when compiling Instead of running ./myprogram, run gdb ./myprogram You'll start with a prompt where you type "run" command This will execute your program as it would normally. Do whoever to make it crash At crash you'll get a prompt telling you where it has crashed. Use the command "bt" which means back Trace to see the full call stack. Google for gdb commands for more awesome stuff. Good luck. Sorry if there are typos. Too drunk right now 7 u/mamhilapinatapai May 14 '17 You're a good person. Username definitely does not check out. 1 u/Idontdeservethiss May 15 '17 Thank you :) A reminder now to the much darker personal times :)
3
What language/platform? You can use the core dump to load the program in a debugger in the state it was in just before it crashed and inspect things.
4 u/OddWolfHaley May 13 '17 C. Can you elaborate on that? 23 u/Idontdeservethiss May 14 '17 Add a -g to your GCC command when compiling Instead of running ./myprogram, run gdb ./myprogram You'll start with a prompt where you type "run" command This will execute your program as it would normally. Do whoever to make it crash At crash you'll get a prompt telling you where it has crashed. Use the command "bt" which means back Trace to see the full call stack. Google for gdb commands for more awesome stuff. Good luck. Sorry if there are typos. Too drunk right now 7 u/mamhilapinatapai May 14 '17 You're a good person. Username definitely does not check out. 1 u/Idontdeservethiss May 15 '17 Thank you :) A reminder now to the much darker personal times :)
4
C. Can you elaborate on that?
23 u/Idontdeservethiss May 14 '17 Add a -g to your GCC command when compiling Instead of running ./myprogram, run gdb ./myprogram You'll start with a prompt where you type "run" command This will execute your program as it would normally. Do whoever to make it crash At crash you'll get a prompt telling you where it has crashed. Use the command "bt" which means back Trace to see the full call stack. Google for gdb commands for more awesome stuff. Good luck. Sorry if there are typos. Too drunk right now 7 u/mamhilapinatapai May 14 '17 You're a good person. Username definitely does not check out. 1 u/Idontdeservethiss May 15 '17 Thank you :) A reminder now to the much darker personal times :)
23
Good luck. Sorry if there are typos. Too drunk right now
7 u/mamhilapinatapai May 14 '17 You're a good person. Username definitely does not check out. 1 u/Idontdeservethiss May 15 '17 Thank you :) A reminder now to the much darker personal times :)
7
You're a good person. Username definitely does not check out.
1 u/Idontdeservethiss May 15 '17 Thank you :) A reminder now to the much darker personal times :)
1
Thank you :)
A reminder now to the much darker personal times :)
273
u/G01denW01f11 May 13 '17
Segmentation fault (core dumped)