OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 2:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Same old mistakes...
PostPosted: Mon Oct 04, 2021 3:41 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
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:
  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


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Mon Oct 04, 2021 5:30 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7612
Location: Germany
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.


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Tue Oct 05, 2021 10:38 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1590
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!


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Tue Oct 05, 2021 12:35 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
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


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Tue Oct 05, 2021 8:50 pm 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 618
Location: North Dakota, United States
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?".


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Fri Oct 08, 2021 4:03 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7612
Location: Germany
Ref. Six Stages of Debugging

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Wed Oct 13, 2021 10:49 am 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
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();}


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Mon Nov 01, 2021 4:07 pm 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
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.


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Tue Nov 02, 2021 2:42 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7612
Location: Germany
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.


Top
 Profile  
 
 Post subject: Re: Same old mistakes...
PostPosted: Mon Dec 20, 2021 1:39 pm 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 811
Location: Hyperspace
Once the brain thinks something is correct, it filters it out.

My friend sent me this; it cracked me up! :lol:
Quote:
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group