Octave debug info randomly displayed

  • Thread starter Thread starter jlefevre76
  • Start date Start date
  • Tags Tags
    Octave
Click For Summary

Discussion Overview

The discussion revolves around an issue with Octave where debug information is unexpectedly displayed during code execution without entering debug mode or throwing errors. Participants explore potential causes and solutions related to debugging settings, code structure, and function naming conflicts.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant describes an unexpected display of debug information during code execution, suggesting it may be related to a setting or accidental breakpoint.
  • Another participant proposes that a command in the script could be triggering debug mode, although no errors are indicated.
  • Concerns are raised about the potential for a naming conflict between user-defined functions and Octave's built-in debug functions.
  • Participants suggest searching the code for specific keywords like 'dbstop' to identify any unintended triggers for debug mode.
  • One participant speculates that excessive output from debug information could be causing Octave to crash due to memory issues.
  • Another participant mentions the possibility of a referencing error similar to issues in C programming, suggesting that debugging might be complicated by corrupted data.
  • Several participants offer strategies for diagnosing the problem, including adding print statements and selectively commenting out code sections.
  • A later post reveals that the issue was caused by a stray 'debug' command in the code, which was not initially recognized as problematic.
  • Discussion includes suggestions to consider alternative programming languages like Julia or Python for future projects.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the cause of the issue initially, but later agree on the identification of a stray command as the source of the debug output. There are multiple competing views on how to diagnose and resolve the problem, and the discussion remains exploratory.

Contextual Notes

Participants mention potential limitations related to memory management and function naming conflicts, but do not resolve these issues. The discussion reflects a range of experiences with debugging in Octave and the challenges associated with it.

Who May Find This Useful

This discussion may be useful for Octave users experiencing similar debugging issues, programmers interested in debugging techniques, and those considering transitioning to other programming languages for better performance or support.

jlefevre76
Messages
119
Reaction score
6
Okay, I'm not sure if one of the Octave settings got messed up or something, but all of a sudden, in the middle of my run, the Octave console displays a message and all of the debug commands, but doesn't throw an error:

'debug' is a function from the file C:\[path to debug.m]

-- Function file: debug ()
Summary of debugging commands. For more information on each command and available options use 'help CMD'.

The debugging commands available in Octave are

'dbstop'
Add a breakpoint.
'dbclear'
Remove a breakpoint.
'dbstatus'
List all breakpoints.
...And it goes on to list all the debugging functions with brief descriptions, etc...It does not enter debug mode.

Anybody know how to suppress this, or what might be causing it? As I remember, my code was working perfectly, but on one run it just starting doing this, and I can't remember what I changed or how I caused it. In any case, my code goes through thousands of iterations, and this is going to keep the code from being able to be completed. Again, no error or warning is officially identified, the display is exactly as described.

Any help is appreciated.

-Jeremy LeFevre
 
Physics news on Phys.org
Yes, but it doesn't say there's a warning, error, or anything else that would require it to enter debug mode, it just starts randomly (as far as I can tell) spitting out information on debug mode.

As for having created a breakpoint, that could be the case, but since Octave does not come with a GUI (at least I am not using one), I have no way of determining where it would be (if I inadvertently created one).

So, I have no idea what is causing it or why it is giving output on debug mode, and not indicating a warning, interruption, error, or problem of some kind.
 
You have to determine at what line the debug kicks in if it is indeed program dependent. Also if you have the source you could search for dbstop or any of the other names used in the link I gave you earlier. It could be that some option or function argument has turned it on as a feature of the library code you're using...
 
That's just it, I have tried it with debug mode on and off (and nothing changed at all). Maybe I haven't described what is happening well enough. It displays the said text, then continues to execute the program. The problem becomes the fact that displaying so much text without clearing causes Octave to crash after only a few iterations (I assume). When I say crash, I mean crash, as it Octave closes itself. No stopping of the program, this weird text displays information about debug mode (which hadn't been activated in the first place), does not stop the code from executing, and then Octave crashes, I can only guess why. So, in other words, it never even enters debug mode, it just displays the said text and continues to execute until it crashes! I cannot see anything in the code that would be causing it to crash (like a divide by zero, a growing array, or anything weird like that). I can only figure that displaying so much unnecessary text it is somehow causing it to crash, but I don't know this for certain.

By the way, it is calling a function, named wedgeRT.m, a code I wrote. There is no reference to debugging anything in the code, not that I'm aware of (and I wrote it, so you'd think I would remember if I had :P ). Thanks for the ideas though.
 
Okay so maybe there is a referencing error. In C code for example, if you forgot to place a null byte at the end of a string and then printed that string it would keep printing forever until it found a null byte.

Since this is showing the text of the debug help then perhaps its a similar kind of situation. If so these kinds of problems are very hard to debug.

One trick might be to try running in debug mode and then see if debug detects something and causes it to stop.

Another trick is to add print statements to it so you can see how far it got before the error occurs and then keep refininf the prints to isolate the offending line if that's the case. This trick doesn't always work if something earlier in your code has corrupted somethings.

Are you sure you haven't exceeded your array indexes? Are you sure you have enough memory on your system and haven't exhausted it during your program run? Do you have enough disk space for caching if Octave is using caching?

The printing of the debug help and then the crash is indicative of a bad pointer somewhere and so the print statements may help you isolate it.

Last trick is to selectively comment out parts of your code to see if the error still exists. As an example, commenting out a for loop or code inside it...
 
If your code isn't too large, you could consider switching to Julia. Its syntax is very similar to MATLAB and Octave and it has better support and is more performant than either one. THe synatx is similar but not the same and there may be a learning curve to go thru to get your program to work.

http://docs.julialang.org/en/release-0.3/manual/noteworthy-differences/

http://docs.julialang.org/en/release-0.3/

There are some good tutorials on it on Youtube by Dave Sanders and by the original developers.
 
  • #10
Ok, thanks. That gives me a few ideas of some things I can try (some of them I already have without success).

LOLZ! I just found it...

So, one of the times I was using debug mode to fix my code, I must have accidentally types the word 'debug' at the end of one of the lines. It looked something like this:

some assignment or function line;debug

Result was, a short tutorial on how to use the debug function printed in my code for no reason and confused me thoroughly...

As a side note, come to think of it, when it first started doing that, I think I was debugging some kind of an overflow of an array or something like that. I think something was gobbling up the memory and causing the crash, so the crash is probably not related to the text after all.
 
  • #11
Great catch!

In post #4, I suggested searching your code for debug keywords which might have found it sooner.

Also one other trick, is usually when a working program that you have made recent changes too fails then it's a good idea to review those areas for odd things and always try to remember what you changed.

At work, I added a shell script to vim to always save the file I'm editing and then on exit it deletes the original if no changes were made. This allows me to use vim -d old.file new.file to see side by side differences in vim.

It's helped me a lot during a debugging session where I may be messing with many parts of the code to be able to compare it to the original.
 
  • #12
Anyway if you get the chance check out Julia. It may ruboff on you and convince you to drop Octave.
 
  • #13
Yes, indeed you mentioned it to me that I should search for that...and, thinking that there was no way I could have possibly written anything like that in my code, I ignored your sage advice. I have never heard of Julia, but I might check it out sometime. I guess for the time being, I will finish up with Octave the project I having going right now. In the long run a lot of people have told me I should change to Python. I kind of wanted to refresh my skills in C. Of course, what language I learn will probably depend most likely on where I end up job-wise, and what my boss says to learn. It could be a while until that happens.
 
  • #14
There's an interesting website that covers both and uses the IPython/IJulia workbench for both Julia nd Python development. The Dave Sanders videos on Youtube utilize it for teaching. The website is:

http://quant-econ.net/python_or_julia.html

With respect to Julia it interoperates well with Python and with Fortran and there's some work to allow it to work with Java and Matlab but they aren't as complete.

There's also the Pyzo.org website that has collected the various scientific python packages together as a one-stop shop for numerical computing in python.
 
Last edited by a moderator:

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
3
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 3 ·
Replies
3
Views
7K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 1 ·
Replies
1
Views
10K
  • · Replies 16 ·
Replies
16
Views
9K