kernel in C++ : adding a class method makes crashing the os
-
- Posts: 14
- Joined: Wed Nov 14, 2007 3:26 pm
- Location: Paris, France
kernel in C++ : adding a class method makes crashing the os
Hi, we are 2 students developping an os in C++.
We have made idt,gdt,irq0 and irq1 to work.
We have got a shell with commands.
this is our Commands'class
#ifndef COMMANDES_HPP
#define COMMANDES_HPP
#include "video.hpp"
#include "iostream.hpp"
#include "keyboard.hpp"
class Commandes
{
private:
void clear();
void systeme();
#if 0
void exit();
#endif
Video * v;
Keyboard key;
unsigned char couleur;
public:
Commandes();
void setArg(Video& vid,unsigned char couleurShell);
void execute(char * querry);
};
#endif
so the os goes good but if we add the exit methode it crash, and if we add some code in an other commands'method too.
If you have any idea :/
We have made idt,gdt,irq0 and irq1 to work.
We have got a shell with commands.
this is our Commands'class
#ifndef COMMANDES_HPP
#define COMMANDES_HPP
#include "video.hpp"
#include "iostream.hpp"
#include "keyboard.hpp"
class Commandes
{
private:
void clear();
void systeme();
#if 0
void exit();
#endif
Video * v;
Keyboard key;
unsigned char couleur;
public:
Commandes();
void setArg(Video& vid,unsigned char couleurShell);
void execute(char * querry);
};
#endif
so the os goes good but if we add the exit methode it crash, and if we add some code in an other commands'method too.
If you have any idea :/
Re: kernel in C++ : adding a class method makes crashing the
Hi,
First, when you change the class header, all source files referencing the class are recompiled (if you are using a custom makefile, this may not automatically happen).
Second, are you using a custom malloc/new implementation. The bug may be with your malloc() routine (when you go over a certain class size, malloc() doesn't like it). This could be for any number of reasons - particularly if you are using paging.
Thirdly, what format is the binary? If you are crashing if you add *any* new methods, chances are that it is the binary relocation / fixup code that needs some attention.
As JamesM said - more detail please. What happens? Triple-fault? Have you got to the stage where you can display a register dumpp on a crash? Does the computer just hang? etc...
Cheers,
AJ
First, when you change the class header, all source files referencing the class are recompiled (if you are using a custom makefile, this may not automatically happen).
Second, are you using a custom malloc/new implementation. The bug may be with your malloc() routine (when you go over a certain class size, malloc() doesn't like it). This could be for any number of reasons - particularly if you are using paging.
Thirdly, what format is the binary? If you are crashing if you add *any* new methods, chances are that it is the binary relocation / fixup code that needs some attention.
As JamesM said - more detail please. What happens? Triple-fault? Have you got to the stage where you can display a register dumpp on a crash? Does the computer just hang? etc...
Cheers,
AJ
-
- Posts: 14
- Joined: Wed Nov 14, 2007 3:26 pm
- Location: Paris, France
firstly we didn't have implemented malloc in our os yet.
we are using ELF format
i sent you a zip containing our os sources.
thx a lot
ps: we are using nasm/as/C and C++
for example the irq0 call a C function which call a C++ function
we are using ELF format
i sent you a zip containing our os sources.
thx a lot
ps: we are using nasm/as/C and C++
for example the irq0 call a C function which call a C++ function
- Attachments
-
- nonos.zip
- (36.13 KiB) Downloaded 54 times
Last edited by jeandaniel on Wed Nov 28, 2007 11:02 am, edited 1 time in total.
-
- Posts: 14
- Joined: Wed Nov 14, 2007 3:26 pm
- Location: Paris, France
Hi,
I don't have time to read through sources at the moment anyway, but how about trying the C PlusPlus wiki article and looking at a few of those suggestions from previously - like reviewing your elf loader, checking you have enough stack space and so on.
It would also be useful to see the Bochs register dump when your program crashes. I'll look tomorrow if I get a chance, but at least have a look at debugging in an emulator first.
Cheers,
Adam
I don't have time to read through sources at the moment anyway, but how about trying the C PlusPlus wiki article and looking at a few of those suggestions from previously - like reviewing your elf loader, checking you have enough stack space and so on.
It would also be useful to see the Bochs register dump when your program crashes. I'll look tomorrow if I get a chance, but at least have a look at debugging in an emulator first.
Cheers,
Adam
-
- Posts: 14
- Joined: Wed Nov 14, 2007 3:26 pm
- Location: Paris, France
-
- Posts: 14
- Joined: Wed Nov 14, 2007 3:26 pm
- Location: Paris, France
i sent you the working version of our OS
If you add some code it will crash.
We don't understand why :/
thx
If you add some code it will crash.
We don't understand why :/
thx
- Attachments
-
- nonos.zip
- (60.41 KiB) Downloaded 49 times