Тёмный

How to track down a seg fault in C 

Jacob Sorber
Подписаться 166 тыс.
Просмотров 25 тыс.
50% 1

Patreon ➤ / jacobsorber
Courses ➤ jacobsorber.th...
Website ➤ www.jacobsorbe...
---
Segmentation faults (or seg faults) can sometimes drive students a bit crazy. They happen when you access memory incorrectly, but the computer's output is a bit vague and leaves students often unsure how to proceed.
So, today, I'm going to help, by giving you some pointers on how to track down a seg fault with GDB. Also, here are a few other related videos.
• Find bugs faster using...
• Finding memory errors ...
***
Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.
About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.
More about me and what I do:
people.cs.clem...
persist.cs.clem... Note that any Amazon links in my video descriptions are generated by Amazon. If you click one of them and then buy something it helps support this channel. Thanks.
***
Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.
About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.
More about me and what I do:
www.jacobsorbe...
people.cs.clem...
persist.cs.clem...
To Support the Channel:
like, subscribe, spread the word
contribute via Patreon --- [ / jacobsorber ]
rep the channel with nerdy merch --- [teespring.com/...]
Source code is also available to Patreon supporters. --- [jsorber-youtub...]
Want me to review your code?
Email the code to js.reviews.code@gmail.com. Code should be simple and in one of the following languages: C, C++, python, java, ruby. You must be the author of the code and have rights to post it. Please include the following statement in your email: "I attest that this is my code, and I hereby give Jacob Sorber the right to use, review, post, comment on, and modify this code on his videos."
You can also find more info about code reviews here.
• I want to review your ...

Опубликовано:

 

13 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 24   
@BenjaminWheeler0510
@BenjaminWheeler0510 2 года назад
Man, every time I learn about a new gdb feature, I start realizing that command-line tools are the superior way to develop.
@coolbrotherf127
@coolbrotherf127 Год назад
The only thing I don't like about it is it being all text based. I feel like I can track down issues faster with a GUI based debugger like in Visual Studio.
@ronnysherer
@ronnysherer 4 года назад
You finally revealed the real star 🌟
@ranchu3203
@ranchu3203 2 года назад
Ui, I think I may just have figured out how to fix an issue in my homebrew virtual CPU. Thanks so much, Jacob.
@2000vikrom
@2000vikrom 4 года назад
I have read the main difference of using clang and gcc is if your write compiler, my question is why do your prefer clang? Love your amazing video imma watch everything it have help me greatly
@JacobSorber
@JacobSorber 4 года назад
I really don't have a strong preference. I used to prefer clang years ago because it seemed to have better error messages than GCC. Now, I don't see a big difference, day to day. I have heard that writing compiler optimizations and plugins is more fun with LLVM.
@2000vikrom
@2000vikrom 4 года назад
@@JacobSorber I have heard that also thanks for the info.
@shreemaan-abhishek
@shreemaan-abhishek Год назад
Such a cute ending.
@B4D4617f
@B4D4617f 6 лет назад
Thank you for the video and tips!
@JacobSorber
@JacobSorber 6 лет назад
You're welcome.
@trakmator
@trakmator 5 лет назад
Awesome Video 😂
@sandarukannangara6346
@sandarukannangara6346 3 года назад
thankyou soo much!
@BenjaminWheeler0510
@BenjaminWheeler0510 2 года назад
awesomeeeeee thank you.
@opjosepher
@opjosepher 9 месяцев назад
this was my code and it helped tbh #include int main() { int A,B,C; printf("Give 2 numbers to multiply them then add 35 to them."); A=3; B=5; C=A*B+35; printf("The total of A*B+35 is:"); scanf(C); return 0; }
@rajanjha5797
@rajanjha5797 5 лет назад
Hi friend ofcourse this is helpful but what about something like this happens in kernel space ..gdb wont be helpful in that case maybe kgdb or valgrind or another tool ..there very less content of such ill be glad if you make one :) ... Also my another request is if you can make one video of spinlock explaing why it keeps the core bussy disscuss the role of scheduler in this and tell us why would we use it as it has alot overhead and what is that situation where we can not choose semaphore or mutex over a spinlock . Its is seriously most wanted question over the internet...
@JacobSorber
@JacobSorber 5 лет назад
I'll see what I can do.
@JeffChentingwei628
@JeffChentingwei628 3 года назад
I just encountered segmentation fault :(
@infinteuniverse
@infinteuniverse 4 года назад
haven't watched the video... please have a method not involving including logging prints throughout your code.. pls pls.
@tsunningwah3471
@tsunningwah3471 7 месяцев назад
zhins!
@kttyblabla
@kttyblabla 3 года назад
hachur
Далее
Incremental Programmers Finish First
4:58
Просмотров 6 тыс.
Debugging with Core Dumps
9:16
Просмотров 64 тыс.
ЧТО ВЫРОСЛО ОТ КОКА КОЛЫ😱#shorts
00:26
When you Accidentally Compromise every CPU on Earth
15:59
How do I access a single bit?
11:07
Просмотров 21 тыс.
Dear Game Developers, Stop Messing This Up!
22:19
Просмотров 719 тыс.
Why Function Pointers are Awesome
11:11
Просмотров 8 тыс.
How To Code A Quantum Computer
20:42
Просмотров 614 тыс.
What is the Smallest Possible .EXE?
17:04
Просмотров 413 тыс.
How to make memory read-only in your C programs.
12:57
C++ Developer Learns Python
9:26
Просмотров 2,7 млн
The Problem with Time & Timezones - Computerphile
10:13