Debugging Octave: Difference between revisions

899 bytes added ,  16 March 2016
no edit summary
No edit summary
Line 10: Line 10:


This will create a new build of Octave in a different directory without optimisations (no -O2 gcc parameter) and with debug symbols compiled in. This build is useful for debugging Octave itself.
This will create a new build of Octave in a different directory without optimisations (no -O2 gcc parameter) and with debug symbols compiled in. This build is useful for debugging Octave itself.
= Debugging Source files without GUI=
Ubuntu introduced a patch to disallow ptracing of non-child processes by non-root users - ie. only a process which is a parent of another process can ptrace it for normal users - whilst root can still ptrace every process.
That's why gdb won't be able to link to the octave process if you start gdb from within an Octave session using the command
<syntaxhighlight lang="bash">
octave> system (sprintf ("gnome-terminal --command 'gdb -p %d'", getpid ()), "async");
</syntaxhighlight>
You can temporarily disable this restriction by doing:
<syntaxhighlight lang="bash">
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
</syntaxhighlight>
and then reopen the gdb using the command mentioned above from within an Octave session.
Instead you can debug octave without gui using: 
<syntaxhighlight lang="bash">
./run-octave -g --no-gui
</syntaxhighlight>


= Debugging oct-files =
= Debugging oct-files =
15

edits