Hehe well, that big "Ghost" text you see there is just the text-only logo of Ghost taken from the website, and painted on a smaller window thats behind the window that has much text. Windows have a little transparency, so thats what comes outhometue wrote:Looks trippy...except I can still read the text. Also on closer inspection the image does have the text "Ghost", but in a ghost-like manner. Is the pun intended?
When your OS goes crazy - Screenshots
- max
- Member
- Posts: 616
- Joined: Mon Mar 05, 2012 11:23 am
- Libera.chat IRC: maxdev
- Location: Germany
- Contact:
Re: When your OS goes crazy - Screenshots
-
- Posts: 3
- Joined: Sat Mar 08, 2014 10:11 pm
Re: When your OS goes crazy - Screenshots
forgot to dereference a pointer for a while loop.
while(str != '\0')
\|/
while(*str != '\0')
while(str != '\0')
\|/
while(*str != '\0')
Re: When your OS goes crazy - Screenshots
I got this the other day...
The cause? A missing variable name meant that what should have been "(var & MASK)" became "( & MASK)". That meant that a file was read into completely the wrong place in memory. (I was working on implementing memory-mapped files.)
The cause? A missing variable name meant that what should have been "(var & MASK)" became "( & MASK)". That meant that a file was read into completely the wrong place in memory. (I was working on implementing memory-mapped files.)
- Attachments
-
- btos-crazy.png (6.01 KiB) Viewed 7340 times
Re: When your OS goes crazy - Screenshots
Are you still not using warnings? Any decent compiler would warn you about using a pointer in place of an integer and vice versa. Also, traditionally only macro names consist of all capitals.mallard wrote:The cause? A missing variable name meant that what should have been "(var & MASK)" became "( & MASK)". That meant that a file was read into completely the wrong place in memory.
Re: When your OS goes crazy - Screenshots
MASK is a constant, so is capitalised (it's C++, so constants really are constant.) The full code included casts e.g. "(char*)((uint32_t)var & MASK)", so with "var" missing, generated no warnings. The line is supposed to get the address of the start of the page that "var" (a pointer) points at.alexfru wrote:
Are you still not using warnings? Any decent compiler would warn you about using a pointer in place of an integer and vice versa. Also, traditionally only macro names consist of all capitals.
Re: When your OS goes crazy - Screenshots
Ouch!mallard wrote:MASK is a constant, so is capitalised (it's C++, so constants really are constant.) The full code included casts e.g. "(char*)((uint32_t)var & MASK)", so with "var" missing, generated no warnings.
- Griwes
- Member
- Posts: 374
- Joined: Sat Jul 30, 2011 10:07 am
- Libera.chat IRC: Griwes
- Location: Wrocław/Racibórz, Poland
- Contact:
Re: When your OS goes crazy - Screenshots
It would generate you an error if you used proper c++ casts instead of the c ones. Also constants in c++ are constants, not macros, and it's macros that are typically capitalised, not constants.mallard wrote:MASK is a constant, so is capitalised (it's C++, so constants really are constant.) The full code included casts e.g. "(char*)((uint32_t)var & MASK)", so with "var" missing, generated no warnings. The line is supposed to get the address of the start of the page that "var" (a pointer) points at.alexfru wrote:
Are you still not using warnings? Any decent compiler would warn you about using a pointer in place of an integer and vice versa. Also, traditionally only macro names consist of all capitals.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Re: When your OS goes crazy - Screenshots
It seems there are more nitpickers in a semi-humours thread than there are in most of the code-related threads... I'm fully aware of the difference between a #define and a C++ constant. In C++ there is almost never a good reason to use a #define for a constant value (in C, "const" values can't be used at compile time (e.g. for array definitions) so they're a necessary evil there). There is at least one C++ style guide that advocates capitalising constants and it also makes sense if you have C and C++ mixed in a project (especially if the same name is used for a #define or a "const" depending on whether __cplusplus is defined...).Griwes wrote:
It would generate you an error if you used proper c++ casts instead of the c ones. Also constants in c++ are constants, not macros, and it's macros that are typically capitalised, not constants.
And no, replacing those C-style casts with "reinterpret_cast" won't make any warnings appear, although the syntax would possibly make it harder to accidentally omit a variable name at the expense of general readability.
- Griwes
- Member
- Posts: 374
- Joined: Sat Jul 30, 2011 10:07 am
- Libera.chat IRC: Griwes
- Location: Wrocław/Racibórz, Poland
- Contact:
Re: When your OS goes crazy - Screenshots
The outer cast - sure, but the inner cast should be a static_cast and that doesn't allow you to cast an address to an int.
And for the capitalization - well, do whatever you want, but this way you easily lose track of what is a preprocessor macro and what isn't, and that's definitely not good.
And for the capitalization - well, do whatever you want, but this way you easily lose track of what is a preprocessor macro and what isn't, and that's definitely not good.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Re: When your OS goes crazy - Screenshots
It looks like an underwater tunnel with a submarine inside.max wrote:something goes wrong
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
- Alan Kay
Re: When your OS goes crazy - Screenshots
This bug:
I don't know how it's physically possible. How can list->elements be NULL when ptr is not? They are the same type, and there's no way any code is executing in between because interrupts are disabled and the interrupt/exception handler prints a message when it executes.
I'm so confused.
I don't know how it's physically possible. How can list->elements be NULL when ptr is not? They are the same type, and there's no way any code is executing in between because interrupts are disabled and the interrupt/exception handler prints a message when it executes.
I'm so confused.
Re: When your OS goes crazy - Screenshots
It's impossible to answer that without seeing the definition of the struct list. Is it also a void**? Why is your memory allocater returning a void** rather than a void*? Are you sure that the line you have highlighted is the one printing the numbers? Why are you getting a kernel panic if the memory allocation didn't fail?
Questions, questions.
And the most important question - why haven't you single-stepped the code in a debugger, when the answer to your confusion should be obvious?
Questions, questions.
And the most important question - why haven't you single-stepped the code in a debugger, when the answer to your confusion should be obvious?
Re: When your OS goes crazy - Screenshots
I said they are the same type. They are both void**.iansjack wrote:It's impossible to answer that without seeing the definition of the struct list. Is it also a void**?
It is returning void*, hence the cast.iansjack wrote:Why is your memory allocater returning a void** rather than a void*?
Yes, no other code is printing those two numbers.iansjack wrote:Are you sure that the line you have highlighted is the one printing the numbers?
Because list->elements is NULL. Later on in the function, you will see "if list->elements == NULL return NULL". The function calling this function is create_heap and if place_sorted_list returns NULL it generates the kernel panic.iansjack wrote:Why are you getting a kernel panic if the memory allocation didn't fail?
I know the memory allocation didn't actually fail but for some reason the assignment to list->elements fails and I am debugging it.
I did, and I couldn't figure it out. I can't do it now because I'm unexpectedly away from my computer for a week.iansjack wrote:And the most important question - why haven't you single-stepped the code in a debugger, when the answer to your confusion should be obvious?
Re: When your OS goes crazy - Screenshots
I guess this bug does not occur when optimizations are disabled right?