multiscale / muscle3

The third major version of the MUltiScale Coupling Library and Environment
Apache License 2.0
25 stars 13 forks source link

Document debugging tricks: run gdb in xterm or screen #189

Closed maarten-ic closed 1 year ago

maarten-ic commented 1 year ago

When you have access to a graphical environment, a nice debugging trick is to do:

implementations:
  <component>:
    executable: xterm
    args:
    - -e
    - 'gdb --args <executable> <args...>'

This opens a new xterm and starts the GNU debugger pointing to your actually executable.

On non-GUI environments a similar thing can be achieved with GNU screen:

implementations:
  <component>:
    executable: screen
    args:
    - -dmS
    - gdb_session
    - gdb
    - --args
    - <executable>
    - <arg1>
    - <arg2...>

Which starts a detached screen session called gdb_session. You can attach to this session when executing (in a separate command line):

screen -r gdb_session

Note: this should not be a detailed explanation on how to use gdb and/or screen: there's plenty of information on either on the internet.

maarten-ic commented 1 year ago

Note: instead of xterm, you can also use other terminals (that probably look better). For example, gnome-terminal:

implementations:
  <component>:
        executable: /usr/bin/gnome-terminal
        args:
        - --tab
        - --active
        - --title="MUSCLE3 wrapper"
        - -- /usr/bin/gdb --args <executabe> <args...>