Page 1 of 1

Same old mistakes...

Posted: Mon Oct 04, 2021 3:41 am
by AJ
Hi all,

I'm posting this essentially for therapeutic purposes. I've come back to a bit of OS Dev after pretty much a 10 year hiatus. I needed something to allow myself to "tune out" of the world, due to a lot of rubbish going on.

Anyway - wrote my PFE handler and all seemed well until the GPF on IRETQ. I used cli/hlt debugging and the stack seemed to be in the right place...hmmm.

The upshot is that at the end of my handler macro I was doing the following:

Code: Select all

  add		$0x16,	%rsp
  iretq
  .endm
Now I'm sure that everyone on here has seen the mistake straight away - and I should have too. This debug should not have taken me a couple of hours :roll:

Cheers,
Adam

Re: Same old mistakes...

Posted: Mon Oct 04, 2021 5:30 am
by Solar
You see that signature below?

The original version of that was my Technical Project Manager back at the time, telling me (after I did spend almost two weeks hunting down a bug that should have been extremely simple to spot):

"Every bug is obvious. Once you've found it."

Don't fret, we've all been there.

Re: Same old mistakes...

Posted: Tue Oct 05, 2021 10:38 am
by nullplan
My employer just spent six man-weeks searching for a bug and fielding a couple of rather irritated calls from the customer. Because of a forgotten break statement between two cases in a switch. It happens.

Re: Same old mistakes...

Posted: Tue Oct 05, 2021 12:35 pm
by nexos
I had GCC's AddressSanitizer absolutely losing its mind a few weeks ago. Why, you ask? It was a simple off-by-a few error in a C string function

Re: Same old mistakes...

Posted: Tue Oct 05, 2021 8:50 pm
by Ethin
I've been trying to debug this triple fault in my kernel when it tries to initialize its heap involving its page tables for months now. GSoC and college have gotten in the way and I (still) haven't figured out precisely what causes the bug, even though I've inserted debug print calls. I have a good theory but its one that doesn't make sense, especially since nobody else that I know of is experiencing it. I'm sure that when I finally figure it out I'll go "well how did I miss that?".

Re: Same old mistakes...

Posted: Fri Oct 08, 2021 4:03 am
by Solar

Re: Same old mistakes...

Posted: Wed Oct 13, 2021 10:49 am
by neon
Hi,

If its any consideration, the amount of times I cant figure out why something doesnt work just to lead the way back to a TODO or FIXME comment...just happened again not too long ago. What starts out as "Why doesn't this work? There isn't a reason why this shouldn't work" leading back to "oh yeah...".

Re: Same old mistakes...

Posted: Mon Nov 01, 2021 4:07 pm
by pvc
I think, it could be fun and interesting to create a whole forum subsection (or at least pinned topic) dedicated to this kind of bugs and mistakes. We all encounter them from time to time, but occasionally something really crazy pops up.

Re: Same old mistakes...

Posted: Tue Nov 02, 2021 2:42 am
by Solar
It would get old pretty fast. In the end it's always the same story...

@neon:

Add a way to easily extract and list all TODO and FIXME comments. I usually have a make target ("make todo") set up for that purpose. I even added a "--todo" option to a Perl script I am working on, which then goes on and scans itself. Then make it a habit of calling that feature at least once per day.

Re: Same old mistakes...

Posted: Mon Dec 20, 2021 1:39 pm
by eekee
Once the brain thinks something is correct, it filters it out.

My friend sent me this; it cracked me up! :lol:
I once spent two hours trying to find a bug in a program. It was driving me crazy. I went over the code line-by-line, working it out in my head, but the logic seemed sound.

Just then a woman came by who knew absolutely nothing about programming. Zip. She asked me how I was doing and I told her about the bug that was driving me crazy. She took one look at my screen and immediately said, "Is that supposed to be a comma or a decimal?"

AAAAAAAARRRRRRRGGGGGGGGGGGGGG.....
I guess the comma didn't fit the formatting.