Search Posts

My kernel crashed after changed from c to c++

My kernel crashed after changed from c to c++, for this bug, a variable value accidentally changed its value, i was not about to know which code changed it. In previous version of GKD, i can turn on the profiling feature to see which memory address has been accessed, but this is not enough because my bochs instrumentation stub haven’t record down which code(memory address) is accessed that memory address. So i enhanced GKD to display the “accessed-by” memory address, i quickly found out what code(s) accessed the crashed memory address.

gkd accessed by

After checking the kernal memory map produced by gcc, i found out my kernel is getting too large and goes beyong my defined area, so two memory areas are overlapping together. C++ is just too large if comparing to C, but i still want to make a pure object-oriented kernel. Lots of OS are using c to build, i think that is too old fashion. Its the time to use more modern language to build a kernel.

kernel eat beyong the limit

As i said, dwarf is really not a good format, it is hard to be interpret, it is also hard to emit dwarf by compiler, because easy to get wrong. objdump just dump the wrong line of c/c++ code, see below:

wrong source code decode

1 comment on My kernel crashed after changed from c to c++

Leave a Reply to Peter_OS Cancel reply

Your email address will not be published. Required fields are marked *