|
Matthew E Cross wrote:
> Oh, you're doing stuff inside the scheduler. Yeah, msleep doesn't work
> too well there :-)
Try delay(). It's the non-scheduler version of msleep(). If you have a
version that's better calibrated, please patch delay() in conio.c to
reflect that.
> The best I could come up with was to overwrite the instruction with a jump
> to itself, and when the scheduler reschedules a task, it would check if it
> was stopped on this instruction; and if it was it would tell the denugger.
A branch to itself is probably the best you can do, as you need an
atomic two-byte instruction. It is also sufficiently uncommon, except
for dead ends like while(1);, which should be avoided anyhow.
This could become mortally elegant, with minimum changes to the
scheduler:
#ifdef ENABLE_BREAKPOINTS
if (*(next_opcode_address_from_stack)==BREAKPOINT_INSTRUCTION)
debugger_breakpoint=next_opcode_address;
#endif
And the debugger does this (assuming it has highest priority):
while(1) {
debugger_breakpoint=0;
breakpoint_found = wait_event( debugger_breakpoint!=0 );
dir_write("Hi PC, breakpoint occurred at...");
// burn cycles so the interrupted task doesn't get to run.
...
}
}
Ah, but you're probably already doing that anyhow. I'm really looking
forward to your debugger!
A+, Markus.
--
Markus L. Noga noga@inrialpes.fr
Check out legOS! http://www.multimania.com/legos/
"Quand on n'a pas de caractere, il faut bien se donner une methode."
-Camus on Software Engineering
|
|
Message is in Reply To:
| | Re: Debugging
|
| (...) Oh, you're doing stuff inside the scheduler. Yeah, msleep doesn't work too well there :-) Yes, the pauses were only so I could see what was going on. Another thing you could do is print messages out the IR port; but I'm not sure how it would (...) (26 years ago, 17-Mar-99, to lugnet.robotics.rcx.legos)
|
7 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|