Debugging Octave: Difference between revisions

Jump to navigation Jump to search
→‎Helpful gdb commands: Mention Octave-specific gdb macros
(→‎Helpful gdb commands: Add "thread apply all bt")
(→‎Helpful gdb commands: Mention Octave-specific gdb macros)
Line 124: Line 124:
=== Helpful gdb commands ===
=== Helpful gdb commands ===
[http://www.gnu.org/software/gdb/documentation gdb documentation]
[http://www.gnu.org/software/gdb/documentation gdb documentation]
The following command shows the back trace of all threads belonging to the Octave process:
<syntaxhighlight lang="bash">
(gdb) thread apply all bt
</syntaxhighlight>


For debugging octave_value variables (e.g. <code>my_octave_value</code>) to find out what the variable actually is (instead of just it's base class):
For debugging octave_value variables (e.g. <code>my_octave_value</code>) to find out what the variable actually is (instead of just it's base class):
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
(gdb) print *(my_octave_value.rep)
(gdb) print *(my_octave_value.rep)
</syntaxhighlight>
</syntaxhighlight>


The following command shows the back trace of all threads belonging to the Octave process:
The file <code>etc/gdbinit</code> in the Octave repository contains some macros that can be helpful:
<syntaxhighlight lang="bash">
* <code>display-dims DIM_VECTOR</code>: Display the contents of an Octave dimension vector.
(gdb) thread apply all bt
* <code>display-dense-array ARRAY</code>: Display the contents of an ordinary, i.e., dense Octave array.
</syntaxhighlight>
* <code>display-sparse-array SPARSE_ARRAY</code>: Display the contents of a sparse Octave array.
* <code>show-octave-dbstack</code>: Display the contents of the current Octave debugging stack.


== ddd ==
== ddd ==
238

edits

Navigation menu