Debugging with Multiple Threads (gdb, pthreads)

Sdílet
Vložit
  • čas přidán 13. 01. 2019
  • Patreon ➤ / jacobsorber
    Courses ➤ jacobsorber.thinkific.com
    Website ➤ www.jacobsorber.com
    ---
    Related Videos:
    GDB/debugging
    • Learn GDB in 60 seconds
    • How to examine memory ...
    • Debug Faster With Cond...
    • GDB Debugging with for...
    • A Buggy Place (Hallowe...
    Threads
    • How to create and join...
    • How to pass arguments ...
    • Safety and Speed Issue...
    ***
    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.clemson.edu/~jsorber/
    persist.cs.clemson.edu/
    ***
    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.jacobsorber.com
    people.cs.clemson.edu/~jsorber/
    persist.cs.clemson.edu/
    To Support the Channel:
    + like, subscribe, spread the word
    + contribute via Patreon --- [ / jacobsorber ]
    + rep the channel with nerdy merch --- [teespring.com/stores/jacob-so...]
    Source code is also available to Patreon supporters. --- [jsorber-youtube-source.heroku...]
    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 ...

Komentáře • 36

  • @GaussianBluff
    @GaussianBluff Před 5 lety +34

    I really like the format of these videos. It's naturally easier to get into as a viewer than a full 1h+ tutorial, but I'm still sometimes surprised how much content you manage to get across in 3-5min without me having to rewatch it.

    • @JacobSorber
      @JacobSorber  Před 5 lety +6

      I do what I can. Glad you enjoyed it.

  • @saicharan3650
    @saicharan3650 Před 4 lety +1

    man you are just awesome. I am struggling with my Operating System lab problems and now you have made it all easy.

  • @abdelazizsaad7676
    @abdelazizsaad7676 Před 3 lety

    This is a very amazing video, please keep such videos coming up.
    The format is just amazing. Easier to get the idea.

  • @TheSRONIX
    @TheSRONIX Před 3 lety

    Great production! Really appreciate the quality

  • @ushnakhan198
    @ushnakhan198 Před 3 lety +5

    This teacher is so amazing ❤️❤️ and so cool love from india

  • @youthfull3616
    @youthfull3616 Před rokem

    very good and precise. love it

  • @rishikeshkumar490
    @rishikeshkumar490 Před 3 lety +1

    This video was really nice and informative .
    It would be better if you explain what is Mutex, Semaphore, Deadlock, Race Conditions , Critical Section with a muti-threaded program in C++. How to debug muti-threaded program in a single video for Interview Preparation.

  • @shushens
    @shushens Před 4 lety

    Super useful as always. I have a question. Debugging multi-threaded programs is of course a challenge, but it is a challenge people have had the chance to discuss for quite some time now. One thing that is relatively less discussed is what to do when you are debugging a process that creates many inferiors, some of which might also become interesting to you. Trying to find them and attaching new instances to them can quickly go out of hand. GDB9.1 claims to have gained new multiprocess debugging capabilities. It would be super interesting to see something in this area. It is not like I am proposing that you demonstrate something that I already know. I am struggling to find information on this, and perhaps you will have better luck than I did :)

  • @hashincludetravel3766
    @hashincludetravel3766 Před 5 lety +1

    watch point used at 3:22 will make the execution quite slow..we can use conditional breakpoint
    watch point definitely has its own use which you explained later.

  • @yjc149
    @yjc149 Před 2 lety

    you are the star!

  • @shrek1412
    @shrek1412 Před 4 lety +1

    thanks, it is very helpful, but what if you work with embedded linux and you don’t have gdb, how do you debug?

  • @fsaforosaforo6338
    @fsaforosaforo6338 Před rokem

    Excellent video on the subject matter of debugging. I see why my school used your video for our class. Thanks for sharing. One question...did you do this Ubutu?

  • @ymi_yugy3133
    @ymi_yugy3133 Před 4 lety

    Is there a way to do the same with multi process programs?

  • @youdy3000
    @youdy3000 Před 5 lety

    Beautiful videos.
    Did you consider an example / video on debugging multi threaded program that paused a specific thread so you could clearly see the other thread complete?

    • @JacobSorber
      @JacobSorber  Před 5 lety

      Thanks, Robert. I'll put it on the list and see what I can do.

    • @youdy3000
      @youdy3000 Před 5 lety

      @@JacobSorber Thanks, Jacob. This is how you achieve that with `lldb`.. stackoverflow.com/questions/56171638/lldb-pause-a-thread-while-other-threads-continue/56174578#56174578

  • @951784623
    @951784623 Před rokem

    Sometimes when I am debugging multiple threads when the threads are being created it lists them all and then the prompt breaks. How can I get the prompt back in this case?

  • @madteen2507
    @madteen2507 Před 3 lety

    Which OS are u using?

  • @abhisheksa6635
    @abhisheksa6635 Před 8 měsíci

    just wow

  • @ihamzaiqbal
    @ihamzaiqbal Před 5 lety

    I am trying to make a simple game using C that uses threads it's a "DRAGON JUMP" game that we can play on chrome when we haven't access INTERNET. I am using 2 characters one is jumping and the second one is horizontally moving but the problem is that when one jumps the second one disappears and when one moves horizontally jumping one disappears.I want both of them to present there.

    • @JacobSorber
      @JacobSorber  Před 5 lety +1

      Sounds like a fun project. I don't have enough information to know what's going wrong, but I wish you all the best as you try to figure it out.

    • @kiwi_wolf2805
      @kiwi_wolf2805 Před 5 lety

      Maybe one of the threads gets locked?

  • @desiganpang5324
    @desiganpang5324 Před 5 lety

    how can i setup the pthreads lib ? i couldnt find any related info on this matter. im using ubuntu on vm

    • @JacobSorber
      @JacobSorber  Před 5 lety +1

      You shouldn't really have to set anything up. Just compile as usual (but link with the library "-lpthread" - not necessary on some machines, but I think on Linux it is). Also, if you look back in my videos a I have a basic intro on creating threads that might help.

    • @desiganpang5324
      @desiganpang5324 Před 5 lety

      @@JacobSorber i copy your code and try to run it, but the system said pthreads is not found, i dont remember the exact error, i also try installing it from sourceforge for window but its the same result

    • @JacobSorber
      @JacobSorber  Před 5 lety

      Did you add "-lpthread" to the compile line (something like... "clang test.c -lpthread")? Try running the command "locate pthread.h". It should find a file at /usr/include/pthread.h. For me, this was all just there when I installed ubuntu.

    • @desiganpang5324
      @desiganpang5324 Před 5 lety +1

      turn out i had a typo in my code where i wrote include, after i remove the s and include the pthread lib in the compile line I was able to run the code. thank you for all your help

  • @vishalggupta
    @vishalggupta Před 3 lety

    Can debugger sleep a thread for a while and other threads keep running in the background?

    • @JacobSorber
      @JacobSorber  Před 3 lety +1

      Sort of. You can set the scheduler locking mode to restrict thread progress, but I believe it only works while step-debugging. As soon as you continue execution, then I believe everything is running again. ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_39.html

  • @eddaly4160
    @eddaly4160 Před 2 lety

    Yikes...get an IDE...great video's...I have been watching many of them

    • @wertigon
      @wertigon Před rokem

      Once you really understand the "behind the scenes" and how vim works, IDEs tend to slow you down more than anything else.
      That said, Visual Code is a really, really, reeeeeeaaaaally nice editor once you figure out how to install support for the vim language... :)

  • @cyrilanisimov
    @cyrilanisimov Před 4 lety +5

    1 dislike))) Who was that guy? Java developer?))))

  • @danielkrajnik3817
    @danielkrajnik3817 Před 3 lety

    the only 2 dislikes were from functional programmers