This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
courses:programming:debug [2024/02/07 06:54] yaroslav.gosudarkin |
courses:programming:debug [2024/02/07 07:23] (current) yaroslav.gosudarkin |
||
---|---|---|---|
Line 104: | Line 104: | ||
* [[https://sourceware.org/gdb/current/onlinedocs/gdb|Полная официальная документация]] | * [[https://sourceware.org/gdb/current/onlinedocs/gdb|Полная официальная документация]] | ||
- | ===== Способ 3. GDB + VS ===== | + | ===== Способ 3. GDB + VSCode ===== |
- | WIP | + | <color #ed1c24>WIP</color> |
+ | |||
+ | Чтобы использовать отладчик gdb из IDE VSCode, необходимо: | ||
+ | |||
+ | Установить расширения для отладки и работы с языком С: | ||
+ | |||
+ | {{courses:programming:screenshot_from_2024-02-07_14-11-54.png}} | ||
+ | {{courses:programming:screenshot_from_2024-02-07_14-12-01.png}} | ||
+ | |||
+ | - Открыть ваш проект/файл в VSCode | ||
+ | - Расставить точки останова напротив интересующих вас строк кода (нажать слева от номер строки) | ||
+ | - Перейти в вкладку "Debug" | ||
+ | |||
+ | {{courses:programming:screenshot_from_2024-02-07_13-51-04.png}} | ||
+ | |||
+ | Нажать комбинацию клавиш ctrl+shift+P (откроется командная консоль vscode) и написать debug. Выбрать С/C++ debugging | ||
+ | |||
+ | {{courses:programming:screenshot_from_2024-02-07_14-16-57.png}} | ||
+ | |||
+ | Сохранить файл launch.json. Теперь у вас есть конфигурация для отладки этой программы. Запустите отладку, нажав F5 | ||
+ | |||
+ | {{courses:programming:screenshot_from_2024-02-07_14-18-13.png}} | ||
+ | |||
+ | Теперь в VScode вам доступен интерфейс отладки: | ||
+ | |||
+ | - Справа панель управления отладкой | ||
+ | - Слева -- состояние памяти и переменных | ||
+ | |||
+ | {{courses:programming:screenshot_from_2024-02-07_14-18-27.png}} | ||
+ | {{courses:programming:screenshot_from_2024-02-07_14-18-34.png}} | ||