Even keyboard are working.
But this c code not generate exceptions:
Code: Select all
int x = 5/0;
int f[4];
f[5] = 8;
Code: Select all
asm("int $0");
Code: Select all
int x = 5/0;
int f[4];
f[5] = 8;
Code: Select all
asm("int $0");
Code: Select all
int x = 5/0;
Code: Select all
int f[4];
f[5] = 8;
Code: Select all
asm("int $0");
Code: Select all
volatile int x = 0;
x = 1 / x;
Code: Select all
asm("div %ah");
Your exception handlers work. BUT DON'T REMOVE OPTIMIZATION. Instead, use the volatile keyword on lines you don't want optimized out.JustVic wrote:It's been something with gcc optimization flags. I remove -O2 and all works. Sorry for late answer
That probably explains the number of problems you seem to have, particularly with regard to debugging. I wouldn't use such aggressive optimization until I was fairly sure that my code is correct.rizxt wrote:I personally use -Ofast.
I dunno, optimizations have never been an issue for me. If I am really stumped on an issue I will try removing optimizations, but even then it still doesn't work.iansjack wrote:That probably explains the number of problems you seem to have, particularly with regard to debugging. I wouldn't use such aggressive optimization until I was fairly sure that my code is correct.rizxt wrote:I personally use -Ofast.
Interestingly, a lot of people find that -Os produces not only the most compact code but also the fastest (but not until you've finished debugging).
Isn't the old fashioned standard practice thoroughly testing both debug and release builds and not releasing if there's issue in either?nullplan wrote:We are getting kind of off-topic, but: I always compile with full optimizations and debug using log messages instead of GDB. The GDB model is abhorrent to me, as it requires me to constantly test a version of the program I will not ship, and then ship a version I have not tested thoroughly. There is some observer effect to the log messages, yes, but there is a hell of a lot more to the mere use of GDB. If I do use debugging capabilities, I use those that show me what is actually going on, not what would be going on if this was a C64 and I was writing in BASIC.