sibl

Lesson 09: Build and Debug dual.out on macOS

Goals

Using VS Code

Steps

The following steps are based on the VS Code instructions.

clang_build_active_file

Figure 1: Menu showing Configure Default Build Task... options.

Assure that the ~/sibl/geo/src/dual/.vscode/tasks.json file appears as follows:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-std=c++11",
                "-stdlib=libc++",
                "-g",
                "${workspaceFolder}/*.cpp",
                "-o",
                "${workspaceFolder}/dual.out"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Build Tasks

This will produce output in the VS Code Terminal window, which will be equivalent to running the following on the command line:

> pwd
/Users/chovey/sibl/geo/src/dual

> /usr/bin/clang++ -std=c++11 -stdlib=libc++ -g /Users/chovey/sibl/geo/src/dual/*.cpp -o /Users/chovey/sibl/geo/src/dual/dual.out
/Users/chovey/sibl/geo/src/dual/Surface.cpp:197:1: warning: non-void function does not return a value [-Wreturn-type]
}
^
1 warning generated.

and creates the following:

On the command line, confirm the executable runs with an exemplar configuration file called circle.yml.
Note: both circle.yml and circle.txt must be present in the same folder, ~/sibl/geo/src/dual/, as dual.out.

> ./dual.out circle.yml                                                         (siblenv)
Build Date : Feb 22 2022
Filename : circle.txt
Resolution: 0.5
Bnds: 0
Refine on the feature only: 0
Reading in curve from file circle.txt
deciding this loop is : in
inCurve with 72 points
Determining derivative...
Setting tangent and angle...
Finding corners...
Finding features...
Done with features.
Done loading and processing curve.
Using parser bounds
Lower bounds: 0, 0
Upper bounds: 0, 0
Nodes size: 605
Dual
Size of my nodes: 0
Size of my Primal nodes: 637
Size of my Primal Polys: 584
Unique loop size: 533
traverse done
projection done
snap done
subdivide done
execution done

The following output files will be created:

Debug

In VS Code, from the Run menu, select Open Configurations and assure the ~/sibl/geo/src/dual/.vscode/launch.json file has the "clang++ - Build and debug active file" listing as follows:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "clang++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/dual.out",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "preLaunchTask": "clang++ build active file"
        }
    ]

start_debugging_main_cpp

Figure 2: Start of the debug session in VS Code.

Index

Previous: Lesson 08

Next: Lesson 10