I spent 1 week debugging my C++ program using GDB/Valgrind...

I spent 1 week debugging my C++ program using GDB/Valgrind, today I found it was missing one single "!" in an if statement.

Attached: 1445972464054.jpg (482x427, 36K)

on the bright side, you found the bug. good job, user. :) now go have a beer.

How large was the program?
Seems like kind of an obvious thing.
Shit like that is usually among the first things I check if something isn't working.

fun

Include iso646.h and save your sanity next time

thanks man
it's not big, it's an esolang, it takes the code and interpret it, the input code was not working as expected, it should be checking the stack for NOT being zero, but it was ==.

you could be me, I spent 1 week doing the literal exact same thing... except it was on a VM... on my windows machine. Was waiting for the crash. Then a windows update happened.

Attached: 1524093929613.png (645x729, 50K)

My worst bug to encounter was due to makefile not detecting a change in header file and building few files with old version and few with new version included. The project had pretty big build time and silly me didn't want to rebuild it.
Technically it was a bug in make script.

>*didn't want to clean and build it from scratch

I once spent 7 hours trying to see if I could unit test webgl applications made with scala.js. I wasn't able to find a way.

You can literally use words like
and not xor or

>1 week tracing a trivial bug
This is why you write unit tests for your functions, user. You could have caught this much sooner.

just spent days hunting a memleak
turns out I'm adding / removing qt5 objects and qt5 shoved them into a deleteLater function.

VueJS does not have this problem

yeah, it be like that sometimes

Do you mean testing each function separately?

>GDB

Just use visual studio

I had a bug in some simulation(500+ lines) for my astrophysics paper and it took me over a month to fix. The problem ? Something that was supposed to be in a for loop was just outside of it. Didn't notice the parenthesis weren't placed properly

Attached: 2019-01-03-174435_323x321_scrot.png (323x321, 21K)

why the fuck would you ever use this?

I once spent a week trying to figure out a connection issue with a server where none of our test users could connect, I eventually went to see if the network port on the server was fucked or something and it turned out one of the deployment guys used an older cable with a broken clip, we had spent a week trying to figure out what was wrong with our setup only to find the CAT6 had slipped out

Attached: 1544532109145.jpg (369x496, 27K)

At work we use Buck, a behemoth aimed at reproducible, incremental, correct builds.

buck clean && buck build has still fixed problems several times.

How did you step through the program without finding where it was fucking up?

you know how i felt
that's it, the problem comes from unexpected places
because i was 100% sure than the if block was correct, sometimes you just assume things are OK and forget them

>because i was 100% sure
Yeah you'll grow out of that mindset pretty quickly

Python does not have this problem

Attached: 1_PXHkfdYyliqb1qCrznu5TQ.jpg (2000x1087, 608K)

I swapped my j with an i in one of my nested for loops and couldn't find it until I ported my homebrew switch game to Linux in order to debug it. Not gonna use 1 letter variable names even in for loops anymore.

It would have only taken you minutes

>assume things
bad idea

I was coding some bullshit for an university project on C and actually spent two days desperate looking for a problem.
The code wasn't working, it was an if statement but it never got inside the conditional.
Turns out I did
if (pessoa.cpf == intermediario);
{
printf("%d\n", pessoa.cpf);
printf("%s\n", "success");
}

Attached: exde.png (512x512, 251K)

>spent two days desperate looking for a problem.

How is the first thing you do not to click to the left of the if statement to make a brake point and step through the execution looking at the values?

This is why splitting up your program into functions/methods is important. That way, you can test specific inputs and outputs much easier.

I decided to refactor something and got a a 6,000 line diff. 90% of the program works much better,. The other 10% is silently failing and I don't know why. It's been days and I still haven't figured it out. If I don't fix it tomorrow I'm giving up on myself.

So you know how to use a debugger?

It's not applicable in this scenario.

Wut...how is a debugger not applicable?

>C++
You only have yourself to blame

Attached: shoot-foot-150x150.jpg~c200.jpg (200x200, 6K)

Is this a trick question?

Right, you'll just an error for a