Menu

how-to-debug-oorexx

Erich

Debugging ooRexx is an advanced topic, typically only for the experts. But still sometimes it may be necessary to provide a stack trace for a bug that you have reported. This How-to can help you doing this on Linux.

How to debug ooRexx on Ubuntu

Install required tools

Debugging requires a debugger named gdb. If you haven't already installed an ooRexx build environment, install gdb using the following command.

sudo apt install gdb

ooRexx Debug version

ooRexx can be built in three different versions:

  1. an unoptimized DEBUG version, and
  2. fully-optimized RELEASE and RELWITHDEBUG versions.

Best results can be achieved when debugging with a DEBUG version, whereas a RELWITHDEBUG version will show less, and a RELEASE version will show least detail.

Try to build your own DEBUG version, or get hold of a DEBUG version from someone else.

Debugging with gdb

Here we assume that a debug version was built in oorexxbuild/debug and the built binaries are in oorexxbuild/debug/bin

cd oorexxbuild/debug
PATH=bin:$PATH gdb bin/rexx
(gdb) run a_failing_rexx_program.rex

Wait until the crash occurs, or the program hangs. Then press Ctrl+C to interrupt.

(gdb) set logging file full_stacktrace.log
(gdb) set logging on
(gdb) info threads
(gdb) thread apply all backtrace
(gdb) set logging off

(gdb) set logging file full_stacktrace_with_variables.log
(gdb) set logging on
(gdb) thread apply all backtrace full
(gdb) set logging off

(gdb) quit

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.