Same old mistakes...

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Same old mistakes...

Post 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
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Same old mistakes...

Post 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.
Every good solution is obvious once you've found it.
nullplan
Member
Member
Posts: 1766
Joined: Wed Aug 30, 2017 8:24 am

Re: Same old mistakes...

Post 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.
Carpe diem!
nexos
Member
Member
Posts: 1078
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Same old mistakes...

Post 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
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Ethin
Member
Member
Posts: 625
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

Re: Same old mistakes...

Post 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?".
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Same old mistakes...

Post by Solar »

Every good solution is obvious once you've found it.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Same old mistakes...

Post 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...".
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
pvc
Member
Member
Posts: 201
Joined: Mon Jan 15, 2018 2:27 pm

Re: Same old mistakes...

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Same old mistakes...

Post 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.
Every good solution is obvious once you've found it.
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Same old mistakes...

Post 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.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Post Reply