Debugging with Core Dumps

Sdílet
Vložit
  • čas přidán 9. 09. 2024

Komentáře • 102

  • @fbafelipe7666
    @fbafelipe7666 Před 3 lety +69

    keep in mind that sending core dumps may have privacy implications. For example, if Excel or Word crash and send a full core dump to microsoft, it would be sending the document the user was viewing/editing as a side effect (since it is loaded on memory), it is also true for any program data manipulate user files/data.

  • @thewavewarden3315
    @thewavewarden3315 Před 2 lety +12

    "You could fill up your disk pretty quick, especially with how frequently your code crashes."
    ROASTED

  • @karlforshaw
    @karlforshaw Před 5 lety +43

    Another great video, and a massive help for all of us who love coding in C but haven't had much of a chance to use it professionally. Thanks Jacob!

    • @JacobSorber
      @JacobSorber  Před 4 lety +15

      I like C. It's pretty low-level, and it occasionally feels like chopping down a tree with a really sharp pocket knife, but from a language-standpoint it's pretty simple. The complications mostly come from the underlying system, which it doesn't hide from you-not the language.

    • @RakeshKumar-vm9xo
      @RakeshKumar-vm9xo Před 3 lety +2

      @@JacobSorber True..

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

    Mile-a-minute, dense, chocked full of stuff I missed or never knew. Wish I'd had a prof this knowledgeable when I went to college. Great stuff, Jacob!

  • @chasedoe2594
    @chasedoe2594 Před 5 lety +17

    That explosion break my ear lol

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

      Sorry. I hope it heals. Segfaults are serious. :)

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

      Your comment saved my ears 2 seconds before the Big Bang
      Thanks a lot 😅

    • @YuanweiLao
      @YuanweiLao Před 3 lety +2

      Same here

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

    Being a part of organisation as a QA, I find this video very helpful. Explained in a way which is very easy to understand. Thank you and keep sharing the knowledge.

  • @samjohnson5044
    @samjohnson5044 Před 3 měsíci

    Thank you for this! I have a GTK widget that crashes every other leap year, will examine with the core dump.

  • @thepinback
    @thepinback Před 2 lety +2

    Nice video! But of the most helpful things with core dumps is the ability to walk the call stack in gdb.

  • @amritagrawal6681
    @amritagrawal6681 Před 4 lety +2

    Superb... Gonna watch all of his video... Thanks a lot sir...

  • @User_Masuri
    @User_Masuri Před rokem

    There isn’t a better video than this in the world!!

  • @GeekyMino
    @GeekyMino Před 3 lety +14

    Hi Jacob , this was a great video but I still have a question. When you deploy your code you are usually using release build which is optimized and probably won't have the debug symbols and further more the target might not have a lot of memory. So how can we use this core dump in such scenario?

  • @matsim0
    @matsim0 Před 2 lety

    IAs someone who writes code for embedded systems and uses mainly python for tasks on my PC, this was _really_ interesting, because I didn't ever do a core dump - I mean, normally I don't even have a file system 😅

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

    Loved the analogy and animation

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

    Professional grade explanation, much appreciated.

  • @mayuparge
    @mayuparge Před 3 lety

    @Jacob Sorber... one of the best video on core dump analysis ...Thanks Jacob

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

    For a detailed discussion, you could have talked about the "??" problem when debugging with coredump files.

    • @JacobSorber
      @JacobSorber  Před 3 lety

      Good idea for a future video. Thanks.

  • @axlslak
    @axlslak Před 4 lety

    love the analogy with space travel. coredump are precious things. :)

  • @andrewseaman2840
    @andrewseaman2840 Před rokem

    Thanks. I enjoyed your video. I'm trying to run RLCraft (a modpack for Minecraft) and have fairly rudimentary coding skills and knowledge. Anyway, the crash report that I got when I loaded the launcher said, "Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again." So that's how I found your video. I still don't know what to do to fix the issue but I do now understand what it's talking about. Thanks

  • @BARaaz04
    @BARaaz04 Před 5 lety +2

    Great video... Thank you, Professor

  • @MichelCarroll
    @MichelCarroll Před 2 lety

    kill -SEGV 4787
    "Oops, wrong pro..." *universe explodes*

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

    Most of them are sending minidumps, along with other possible values. It would be lovely if you made a video on minidumps as well.

  • @sunnybambooflute
    @sunnybambooflute Před rokem

    thanks for sharing the knowledge, btw we are using the same slack notify sound. lol

  • @swedishpsychopath8795
    @swedishpsychopath8795 Před 7 měsíci +1

    I always thought that a core dump was something you had to submit to the CPU manufacturer (Intel/Amd/etc) or to NASA so that technicians in white lab coats could read the machine code that was in the CPU at the moment after the program crashed using an open CPU with lots of wires connected to it and where they looked at the contents of the memory with an electron microscope. But then it turns out that anyone can look at the program code with a simple debugger. Why couldn't they say this 40 years ago when I started as a programmer?

  • @stelluspereira
    @stelluspereira Před rokem

    Thankyou for helping the ‘C’ community

  • @MinusGix
    @MinusGix Před 5 lety +2

    Thanks! Your videos are very informative, and have helped me a lot.

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

      Glad they're helpful. Let me know if there are other topics you think I should cover.

    • @MinusGix
      @MinusGix Před 5 lety

      ​@@JacobSorber A video on the Linux (POSIX?) LD_PRELOAD environment variable would be interesting.
      Solving circular includes (such as with include guards) would be a useful video for people writing code.
      (Assuming you haven't already covered these, haven't yet watched all of the videos. They're quite good and to the point.)

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

      @@MinusGix I have covered LD_PRELOAD (see the videos on shims) and include guards (fairly recent video on headers).

    • @MinusGix
      @MinusGix Před 5 lety

      ​@@JacobSorber Ah, ok. I had been watching the videos from oldest to newest to make sure I watched them in order, and hadn't gotten to them yet.
      There is inline asm (unsure if clang has it, but GCC does), but that's rather obscure and most people don't use it.
      Videos about common C patterns, such as common ways of structuring your programs would be interesting. (Such as writing code that uses flags, and why you would do such a thing.)
      Could go into common ways that C++ library methods are written using C. This bit me when I recently tried using the Windows Direct2D api as the way it's structured to translate to C isn't obvious (the docs are all for C++ as well..) but I don't know if that's a common way of translating C++ to C or not.
      There is writing a less-featured clone of a linux utility (perhaps ls?) and comment about the design decisions you make as you write it. That would be different from your usual videos though.
      Since you seem to do embedded fairly often (?) you could talk about writing efficient code, and how the compiler also at times knows better than you.
      Examining the assembled output of simple C programs to see how there can be differences. (godbolt.org is quite nice for such a thing, but this would also be a good way to also show some linux utilities)

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

    very helpful , thank you !

  • @GabinoHernandez-kt9js
    @GabinoHernandez-kt9js Před 4 měsíci

    I LOVE YOUR VIDEOS!!!!!

  • @simonmaracine4721
    @simonmaracine4721 Před 3 lety

    This was very helpful. Thank you!

  • @unsafecast3636
    @unsafecast3636 Před 3 lety +2

    My linux system has core dumps to unlimited by default.
    I'm using Arch

  • @albertomedinarobredo
    @albertomedinarobredo Před rokem

    thanks matthew

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

    So... If I set the limit to a finite number and the core dump gets truncated... how useful is it gonna be than? Can I be sure to at least have the stack in it then?

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

    How to deal with coredumps that are generated/dumped in the target which is running on a different architecture?
    Assume,
    -> Host is x86 and Target is armhf
    -> Target doesn't have gdb/memory to debug on Target itself.

  • @gauravsaini5549
    @gauravsaini5549 Před 3 lety

    very Informative, Thanks for the video!

  • @nischayranjan3728
    @nischayranjan3728 Před 2 lety +1

    "core" file is not being generated in my linux. I went through all the same commands, as it is explained in the video

  • @karthik2705
    @karthik2705 Před 10 měsíci

    One of my binary crashed. And the bt is pointing to (static) library part
    I tried compiling library with debug sumbols enabled. But the bt is pointing to wrong code
    How to debug this scenario ?

  • @surj8749
    @surj8749 Před 2 lety

    Great video

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

    great video!, Since you usually don't release with debug-symbols, I wonder how useful the coredump may be in this case. How can you extract anything without debug-symbols?

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

      Good question (and good idea for a future video). Debugging without debug symbols is definitely more painful. You can still look at the assembly. You can also release with debug symbols (accepting the downsides). Or, you can generate two versions of the binary (one with and one without debug symbols) and then use the debuggable version with the core dump. For release builds, I think I favor the last one.

    • @SimonJentzschX7
      @SimonJentzschX7 Před 5 lety

      @@JacobSorber Right, But as far as I understand it, if I put in Debug-Symbols I cannot use the optimize-flags.

  • @AnnatarTheMaia
    @AnnatarTheMaia Před rokem

    You didn't explain how to compile the program to contain all the debugging information so that the core file could be debugged in situ on a remote system where the source code to step through would not be available, for example at a client's site.

  • @sobad123
    @sobad123 Před 2 lety

    great video! thank u

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

    great, but an issue, i have a mac, running vscode on its terminal, when i tried gdb but it says "bash gdb command not found"

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

      Yeah, gdb doesn't come installed by default on MacOS. Also, Apple favors clang and lldb, and has done some things that make it tricky to get gdb working well on MacOS.

    • @GrozaRobertGenaro
      @GrozaRobertGenaro Před 4 lety

      Jacob Sorber yeah, lldb worked

  • @mehmetdemir-lf2vm
    @mehmetdemir-lf2vm Před 3 lety +2

    rand()%255 should have been rand()&255 or rand()%256 :)

    • @sverkeren
      @sverkeren Před 2 lety

      Not if the purpose was to generate random number from 0 to 254. :-)

  • @valekprometey
    @valekprometey Před rokem

    Can I unlimit -c for certain processes, but not for all?

  • @bibloc5293
    @bibloc5293 Před 3 lety

    Are you sitting on the floor or some small chair? I am looking for ergonomic sitting positions as debugging can take hours or days.

  • @MrDimonsky
    @MrDimonsky Před rokem

    My problem under Ubuntu - no core dumped generated. I tried everything already..

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

    If you set it to like half the size of the full core dump is will that possibly not include the info you want or maybe not let the debugger run properly?
    I don't understand what information it absolutely needs.

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

      Good question. If the core dump is larger than the limit, it won't save any of it (rather than saving part of the memory). It's all or nothing, because it would be difficult to know what memory is most helpful.

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

      @@JacobSorber so what is the use of adding a limit if it won't use the limit?

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

      @@XenoTravis maybe it means.. if the size is lesser than the limit then only make core dump, otherwise forget it.

  • @aniltadikamalla4236
    @aniltadikamalla4236 Před 3 lety

    I have some problem in usage of GDB. can you please help me out here?

  • @NeZversSounds
    @NeZversSounds Před 3 lety

    Wait, that means the user finding bug will need to tinker with the machine (assuming can get admin privileges) then try to crash it again to actually get a core dump. Sounds like too many loops to jump to help the developer to fix the app. Then how those apps with crash reports can get it without that?

    • @redcrafterlppa303
      @redcrafterlppa303 Před 2 lety

      It's only an assumption. But I guess programs with crash reports run a small runtime that catches segfaults and saves them before the operating system receives and trashes them.

  • @shivanaikrachanaikar2843

    i have core dump file how can i analyze it and which tool i need to download

  • @first-thoughtgiver-of-will2456
    @first-thoughtgiver-of-will2456 Před 4 měsíci +1

    what is this std bloatware you speak of I write my HAL in my applications

  • @hdqhdjxiwj
    @hdqhdjxiwj Před 2 lety

    sad little zero made my day

  • @exploringlife9323
    @exploringlife9323 Před rokem

    i didn't find core file after dump

  • @recepbashir7216
    @recepbashir7216 Před rokem

    nice

  • @MECHANISMUS
    @MECHANISMUS Před 2 lety

    There's hope...

  • @Victor_Marius
    @Victor_Marius Před 2 lety

    Are coredumps available in python?

  • @activelivingchallenger4298

    my school won't let me use ulimit -c to anything other than 0 on their machines. So I just used git and used it on my local machine. Hope that helps anyone.

  • @aidenpearce5724
    @aidenpearce5724 Před 4 lety

    is there any video about makefile that you uploaded ?

    • @JacobSorber
      @JacobSorber  Před 4 lety

      Yeah, I have a few. czcams.com/video/a8mPKBxQ9No/video.html

    • @aidenpearce5724
      @aidenpearce5724 Před 4 lety

      @@JacobSorber thx jacob, hope you can make series about make more than 60 seconds 💪💪💪

  • @leokiller123able
    @leokiller123able Před 3 lety

    Poor Lego guy :(

  • @user-it8yh8tu7d
    @user-it8yh8tu7d Před 7 měsíci

    "Taint analysis" , "core dump".

  • @dnbndu
    @dnbndu Před 3 lety

    Feeling sad for the one who was flying 🥲

    • @JacobSorber
      @JacobSorber  Před 3 lety

      Yeah, seg faults are sometimes scary and sad. But, I have it on good authority that he bailed out in time.

    • @dnbndu
      @dnbndu Před 3 lety

      @@JacobSorber now I can sleep comfortably. 🙏

  • @synchro-dentally1965
    @synchro-dentally1965 Před 2 lety

    3:00 The dump is a lie...

  • @kapilverma2668
    @kapilverma2668 Před 3 lety

    How to write our own memory leak detector?

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

      One way is to use a shim to intercept malloc, calloc, realloc, and free calls, and then keep track of what blocks have been allocated and their sizes, and then check to see what blocks aren't freed at the end.

    • @kapilverma2668
      @kapilverma2668 Před 3 lety

      @@JacobSorber Is it possible with MSVC on windows?

    • @BetaChri5
      @BetaChri5 Před 3 lety

      @@kapilverma2668 Yes

    • @kapilverma2668
      @kapilverma2668 Před 3 lety

      @@BetaChri5 How

  • @DipietroGuido
    @DipietroGuido Před 3 lety

    "Now, when this program eventually crashes, as we knew it would, it says that it 'Core dumped'. It means the computer dumped the content of the process' memory when it crashed. Except for the fact that it really didn't. I'm sorry to break it to you, but sometimes computers lie." - Jacob the Sorber, 1984, University of Wakanda

  • @m4l490n
    @m4l490n Před 3 lety

    lol, that was an overly dramatic intro.
    Oh boy, core files are certainly big. I have a small program that generates a 71MB core file.

  • @franciscomelojunior2535

    Starts at 2:00

  • @PrashantMarshal
    @PrashantMarshal Před 3 lety

    A good introductory video, but a bad waste of 1 minute at the start. Cheers!