How to do linux debugging SCIP remotely using Visual Studio Code

1. Prerequisites

Version of SCIP: SCIP9.0.0.0
Target Machine: Ubuntu Desktop 22.04
Host Machine: Windows10
OS username: scipuser
Working directory: /home/scipuser

2. Problem

Hereinafter we assume your username is postgres. Perform the follwing steps in target machine according to [1].

(1) Download and extract tarball of sources of SCIP from official page[2] with along to the recommendation of GitHub INSTALL.md[1].
tar xvzf ./scipoptsuite-9.0.0.tgz
cd ./scipoptsuite-9.0.0

3. Preparation in host machine

(1) According to [3] etc., install Visual Studio Code and set up for remote development using extensions, Remote-SSH, C/C++, etc.

(2) Select [Run]>[Add Configuration] and add the following configuration to “launch.json”

{
    “version”: “0.2.0”,
    “configurations”: [
        {
            “name”: “(gdb) Launch”,
            “type”: “cppdbg”,
            “request”: “launch”,
            “program”: “/opt/scip/bin/scip”,
            “args”: [“-f”, “/home/scipuser/scipoptsuite-9.0.0/build/simple.lp”],
            “stopAtEntry”: false,
            “cwd”: “${fileDirname}”,
            “environment”: [],
            “externalConsole”: false,
            “MIMode”: “gdb”,
            “setupCommands”: [
                {
                    “description”: “Enable pretty-printing for gdb”,
                    “text”: “-enable-pretty-printing”,
                    “ignoreFailures”: true
                },
                {
                    “description”: “Set Disassembly Flavor to Intel”,
                    “text”: “-gdb-set disassembly-flavor intel”,
                    “ignoreFailures”: true
                }
            ]
        }
    ]
}

4. Debugging

(1) In host machine, view [Breakpoints] and set a breakpoint on any function, for example, SCIPsolve().

(2) In host machine, select [Run]>[Start Debugging]. If you can see PostgreSQL server stopping at SCIPsolve() in scip_solve.c, debugging success.

5. References

[1] SCIP GitHub repository, INSTALL.md
https://github.com/scipopt/scip/blob/master/INSTALL.md

[2] SCIP9.0.0 Download Page
https://scipopt.org/download.php?fname=scipoptsuite-9.0.0.tgz

[3] Remote Development using SSH
https://code.visualstudio.com/docs/remote/ssh

[4] Configuring C/C++ debugging
https://code.visualstudio.com/docs/cpp/launch-json-reference

[5] SCIP FAQ, How can I debug in SCIP?
https://www.scipopt.org/doc/html/FAQ.php#howtodebug

Published by ktke109

I love open souce database management systems.