Except the C++ “Core dumped” line is telling you it just wrote a file out with the full state of the program at the time of the crash, you can load it up and see where it crashed and then go and look at what every local variable was at the time of the crash.
Pretty sure you can even step backwards in time with a good debugger to find out exactly how you got to the state you’re currently in.
imagine if it, like, told you this so you didn’t have to find out about it via a post on lemmy
tl;dw: writes to the path in /proc/sys/kernel/core_pattern
If you are using systemd, there’s a tool called coredumpctl.
let’s not act like Java’s error log is useful
Super-advanced java devs like me do it like try{} catch (Exception e) { System.out.println("something went wrong"); e.printStackTrace(); }
you can follow any exception down to the exact line of code
Which is usually not a piece of code written by us and is caused by another piece of code not written by us either
Does your IDE not highlight the lines written by you in a different colour? Of course that doesn’t help when it’s an error in production!
but you can follow any exception down to the exact line of code (or JNI call, I guess) where the problem occurs.
But, it’s not really where the problem occurred. How often do you get a stack trace and the bug fix is at the line referenced by the stack trace? Almost never. It’s more that it takes you down to the exact line of code where the effects of the problem are bad enough to affect the running of the program. But, the actual problem happened earlier, sometimes much earlier.
For example, NullPointerException isn’t actually the problem, it’s a symptom of the problem. Something didn’t get initialized properly, and nobody noticed for a while, until we tried to use it, and got a null pointer. Sometimes it’s easy to go from the effect (null pointer) to the cause (uninitialized thing). But, other times that “thing” was passed in, so you have to work backwards to try to figure out where that thing comes from, and why it’s in that broken state.
Sure, it’s better than nothing, but it’s still frustrating.
I think it’s pretty useful, be interested to hear your hangups with it though because it’s definitely not perfect.
If something goes wrong and I have a stack trace, that plus the type of exception will almost always be enough for me to figure out what’s wrong at least as a starting point. I’ve worked mostly with JVM languages in my career though so maybe I just don’t know how bad it actually is.
The same applies to using the core dump.
In fact, the Python one is the lest useful of the trio.
My favorite compile error happened while I was taking a Haskell class.
ghc: panic! (the ‘impossible’ happened)
The issue is plainly stated, and it provides clear next steps to the developer.
I had a similar error, though not from the compiler
Error message just read this should never happen
Python: So you used spaces and tabs for indentation? NOW DIE!
Find me anyone who claims they use tabs for indentation, and I bet I’ll find at least one case where they’re using both tabs and spaces.
The only safe way to avoid war crimes is to avoid tabs.
Don’t IDEs just replace any tab with 4 spaces anyways? Pretty sure VSCode does
Why would I use spaces if I use tabs? Also, it seemd like a huge waste of time hitting the space bar so many times…
Linux kernel?
https://www.kernel.org/doc/html/v4.10/process/coding-style.html#indentation
edit: oh python, nevermind
Good. Spaces and tabs for indentation should never be mixed in any language other than Whitespace.
Some people use tabs for indentation and spaces for alignment. It kind of gets the pros of tabs (user configurable indent-width) and the pros of spaces (alignment). That doesn’t work in Python where you can’t align stuff and the interpreter doesn’t allow mixing tabs with spaces, but in other languages it is a possible style.
Rust developer: I’d like to compile some code
Rust compiler: the fuck you are
The rust compiler holds your hand, wraps you in blankets, makes you hot chocolate, kisses you on the forehead before it gently and politely points out what you did wrong and how you can solve it step-by-step. It would never think of something as heinous as swearing at you, shame on you for insulting my wife’s honour like this.
Rust compiler is passive agressive, like:
“There’s an error at line 286 because you still don’t know how to use the borrow checker after all this time ♥️”
I don’t know from where this legend comes from but lifetimes/concurrency/macros errors are brain-hurting.
Most of the time I find myself dropping project because I wrote my program in a correct way but Rust just does not like how it is designed lol. I can’t get shit done with this language