OS faulting

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
stonedzealot

OS faulting

Post by stonedzealot »

The strangest thing keeps happening to me. I write a new piece of code (if you've read some other posts, you'll know I've been doing string work) and I'll get a fault call. I'm not sure which fault it is (that's the next step) but the fault is irrelevant. So, after getting this fault call, I start putting in print commands to try and find out which line is giving the fault...and the fault goes away.

Of course, if I strip those print commands (delete or comment) the fault returns. Now I can't imagine what a print command could do to clear a fault for something else, but that's all I can reason. What do you think it could be?
chrisa128

Re:OS faulting

Post by chrisa128 »

I had a problem like this once, I'm not sure what I was doing but same thing.

The print command acts like a delay and so causes it to work. I changed my print statments to empty loops.
stonedzealot

Re:OS faulting

Post by stonedzealot »

I see...very interesting. Thanks alot, that makes sense. Huh. That's so odd.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:OS faulting

Post by Pype.Clicker »

adding a "print" command do also increase the length of your code and allocate more space for your string in the .text section, so if you had some un-(bad?)-initialized pointers you were writing to, you might be now writing to another area (some text string) that will no longer introduce bugz while you were earlier destroying something.

That kind of address-dependent errors may become very usual without a strong programming style (like having void *ptr=NULL; instead of void *ptr; and strncpy instead of strcpy ...)

Maybe if you show your C code i could pin point some common mistakes you might have made ...

maybe it's something much more 3v1l, though, don't take it as an offence ... i just seen plenty of student-code that had that kind of behaviour, and when my code behaves like this, it's 99.999% due to that kind of silly bad-address/buffer-overflow mistakes ...
stonedzealot

Re:OS faulting

Post by stonedzealot »

Well considering that Im away from my dev-comp right now, I can't show you the code, but you're right. I had a lot of stuff like that in there. Uninitialized crap and unterminated strings, etc. That's the kinda stuff that happens when you half sleep at the keyboard, I suppose.
Post Reply