LtG wrote:
Both the first and second form you used for the array create 10 elements in the array, the first form has 10 structs in the array the second just pointers, so no structs allocated in that one.
Are you saying that having that line of code causes it to triple fault? If you modify the second form from 10 to say 1000 or 10000 will it now crash too? If it does it could mean that you are just allocating too much memory and the issue isn't with this code, it's with your memory allocation, where you potentially don't handle page faults (or you have segmentation issues and cause a #GP) correctly, and that causes double fault -> triple.
If you don't have a double fault handler, create it. Then figure out what caused the double fault, and create a handler for that too. Of course you could (and should) start by having handlers for all the possible exceptions, just kpanic() in them and later add more proper code (ie. handling the actual exception instead of panicking).
As for debugging, you can always debug, even if gdb doesn't work. For instance you can add HLT in many places and see how far in your code you can get before triple fault, etc.
As for gdb, have you tried compiling your code with debugging enabled and optimizations disabled? And did gdb actually _crash_ or just give error? If it crashes then I'd consider that a bug and you should report it.
I want this
command_t command_list[10];. I don't need to allocate anything, no pointers, nothing. Basically what I want is to have an array that contains 10 commands (struct command_t).
That exact line causes it to triple fault.
I already have an exception handler that contains every possible fault code. It just does not trigger.
Actually there is nothing to "hlt" debug in the first place, there is only one line of code that does it.
It didn't just crash, that error showed up and debugging had to be terminated (Y/N question).
Edit:When I compiled it without any optimizations GDB started working again. Thanks!