|
| 1 | +--- |
| 2 | +title: Debugging |
| 3 | +description: Debugging Fano Framework web application |
| 4 | +--- |
| 5 | + |
| 6 | +<h1 class="major">Debugging</h1> |
| 7 | + |
| 8 | +This section explains how to debug Fano Framework web application. This document assumes that you know how to create Fano Framework web application project. If you do not, you should read [Getting Started](/getting-started) document first. |
| 9 | + |
| 10 | +## Debugging in Visual Studio Code IDE |
| 11 | + |
| 12 | +### Install NativeDebug extension |
| 13 | + |
| 14 | +We will install [Native Debug](https://github.com/WebFreak001/code-debug) extension to debug in Visual Studio Code with GDB debugger. Installation process is straightforward. Press `Ctrl + Shift + X` keyboard shortcut to open *Extensions* tab. Type *Native Debug* to search extension and click *Install* button. Wait until installation is complete. |
| 15 | + |
| 16 | +### Create launch.json file |
| 17 | + |
| 18 | +Open Run tab (`Ctrl + Shift + D`) click *Run and Debug* button and select GDB environment. |
| 19 | +Visual Studio Code will create `launch.json` file. Replace `name` and `target` like so |
| 20 | + |
| 21 | +``` |
| 22 | +{ |
| 23 | + "version": "0.2.0", |
| 24 | + "configurations": [ |
| 25 | + { |
| 26 | + "name": "Debug Fano", |
| 27 | + "type": "gdb", |
| 28 | + "request": "launch", |
| 29 | + "target": "./bin/app.cgi", |
| 30 | + "cwd": "${workspaceRoot}", |
| 31 | + "valuesFormatting": "parseText" |
| 32 | + } |
| 33 | + ] |
| 34 | +} |
| 35 | +``` |
| 36 | +Save and close it. |
| 37 | + |
| 38 | +Now when you open *Run* tab (`Ctrl + Shift + D`) you will see *Debug Fano* on top. |
| 39 | + |
| 40 | +### Build executable for development |
| 41 | + |
| 42 | +To be able to debug, we need debugging information inside executable binary. Go to |
| 43 | +shell and from inside project root directory, run |
| 44 | + |
| 45 | +``` |
| 46 | +$ ./tools/clean.sh |
| 47 | +$ BUILD_TYPE=dev ./build.sh |
| 48 | +``` |
| 49 | + |
| 50 | +This will compile Fano Framework web application with debugging information. |
| 51 | + |
| 52 | +### Start debugging |
| 53 | + |
| 54 | +Back to Visual Studio Code IDE. Open source code file you want to debug and toggle breakpoint at line of interest by clicking on empty area left of line number. Activate *Run* tab click green button on left of *Debug Fano* to start debugging. |
| 55 | + |
| 56 | +## Debugging in Lazarus IDE |
| 57 | + |
| 58 | +*TODO* |
| 59 | + |
| 60 | +## Explore more |
| 61 | + |
| 62 | +- [Getting started](/getting-started) |
| 63 | +- [Step-By-Step Tutorials](/tutorials) |
0 commit comments