[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to either diagnose or workaround code that makes octave get stuc
From: |
Laurent Hoeltgen |
Subject: |
Re: How to either diagnose or workaround code that makes octave get stuck |
Date: |
Sun, 01 Jul 2012 10:29:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
On 07/01/2012 10:08 AM, andrewcd wrote:
> Thanks Marco, I wasn't aware of those commands, but anyway I am not sure that
> they are what I am looking for. I don't get tied up in an error message, I
> get tied up in some process that doesn't end.
>
> It turns out that I've found the source of the problem -- it was a "while
> change>1e-9" thing, and change never got that low. I've since fixed my
> code, because I should never have functions that don't behave in my
> application.
>
> But still, it would be nice to be able to manually hit break (the big red
> X), then type some command to see what was the last thing that octave tried
> to do -- from what line and what function.
>
> It would also be nice to be able to have octave skip to some section of code
> whenever it gets stuck on one particular code line for longer than S
> seconds.
>
> Are either of these possible?
>
> --
> View this message in context:
> http://octave.1599824.n4.nabble.com/How-to-either-diagnose-or-workaround-code-that-makes-octave-get-stuck-tp4631122p4631126.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
>
Hi,
octave has the functions debug_on_interrupt(), debug_on_warning() and
debug_on_error(). Maybe you could exploit these like this: Inside your
code check for how long the code has been running (using for example the
function clock()) and if it exceeds a certain threshold, throw an error
or a warning. If I understand the definitions of debug_on_warning() and
debug_on_error() correctly, it should jump into debug mode and you can
examine what the code has been doing at that moment.
I know this is kind of hackish, but I don't know of any better method to
realize your task.
Regards,
Laurent