Не запускается отладка в QtCreator на Astra Linux
QtCreator 6.0.2, AstraLinux 1.7. Проект собирается через CMake, если это имеет значение. Отладка вроде настроена как надо, тип сборки стоит Debug, но при запуске в режиме отладки в правом нижнем углу плашка «Запуск отладчика» показывает красный цвет. В журнале такие записи:
dEXAMINING /home/astra/Projects/bss/build/bin/self-info
dELF SECTIONS: .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .qtversion .eh_frame_hdr .eh_frame .gcc_except_table .init_array .fini_array .data.rel.ro .dynamic .got .got.plt .data .bss .comment .debug_aranges .debug_info .debug_abbrev .debug_line .debug_str .debug_ranges .symtab .strtab .shstrtab
dStart parameters: 'self-info' mode: 1
dABI: x86-linux-generic-elf-64bit
dLanguages: c++
dExecutable: /home/astra/Projects/bss/build/bin/self-info
dDirectory: /home/astra/Projects/bss/build/bin
dDebugger: /usr/bin/gdb
dProject: /home/astra/Projects/bss
dAdditional Search Directories:
dSysroot:
dDebug Source Location:
dDebugger settings:
dState changed from DebuggerNotReady(0) to EngineSetupRequested(1)
dCALL: SETUP ENGINE
dTRYING TO START ADAPTER
dENABLING TEST CASE: 0
dSTARTING /usr/bin/gdb --tty=/tmp/QtCreator-uXHODZ/outputcollector.MRMaXl -i mi
dGDB STARTED, INITIALIZING IT
>&"show version\n"
>~"GNU gdb (AstraLinuxSE 8.2.1-2) 8.2.1\n"
>~"Copyright (C) 2018 Free Software Foundation, Inc.\n"
>~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
>~"\nType \"show copying\" and \"show warranty\" for details.\n"
>~"This GDB was configured as \"x86_64-linux-gnu\".\n"
>~"Type \"show configuration\" for configuration details.\n"
>&"set substitute-path /home/qt/work/qt /usr/include/x86_64-linux-gnu/../Src\n"
>790^done
>&"python sys.path.insert(1, '/usr/share/qtcreator/debugger/')\n"
>791^done
>&"python sys.path.append('/usr/bin/gdb/data-directory/python')\n"
>792^done
>&"python from gdbbridge import *\n"
>793^done
>&"python theDumper.setFallbackQtVersion({\"token\":794,\"version\":331522})\n"
>~"bridgemessage={msg=\"b'got fallback qt version 0x50f02'\"},\n"
>794^done
>&"python theDumper.loadDumpers({\"token\":795})\n"
>&"cd /home/astra/Projects/bss/build/bin\n"
>~"Working directory /home/astra/Projects/bss/build/bin.\n"
>799^done
>800^done
dNOTE: ENGINE SETUP OK
dState changed from EngineSetupRequested(1) to EngineRunRequested(3)
dCALL: RUN ENGINE
Установка точек останова...
dУстановка точек останова...
dTAKING OWNERSHIP OF BREAKPOINT 1
dRUNNING NEEDS-STOP COMMAND -break-insert -f "\"imitator.cpp\":276"
dUNSAFE STATE FOR QUEUED COMMAND. EXECUTING IMMEDIATELY
<801-break-insert -f "\"imitator.cpp\":276"
dTAKING OWNERSHIP OF BREAKPOINT 2
dRUNNING NEEDS-STOP COMMAND -break-insert -f "\"main.cpp\":62"
dUNSAFE STATE FOR QUEUED COMMAND. EXECUTING IMMEDIATELY
<802-break-insert -f "\"main.cpp\":62"
dTAKING OWNERSHIP OF BREAKPOINT 6
dRUNNING NEEDS-STOP COMMAND -break-insert -f "\"selfinformation.cpp\":30"
dUNSAFE STATE FOR QUEUED COMMAND. EXECUTING IMMEDIATELY
<803-break-insert -f "\"selfinformation.cpp\":30"
dTAKING OWNERSHIP OF BREAKPOINT 7
dRUNNING NEEDS-STOP COMMAND -break-insert -f "\"CMakeLists.txt\":9"
dUNSAFE STATE FOR QUEUED COMMAND. EXECUTING IMMEDIATELY
<804-break-insert -f "\"CMakeLists.txt\":9"
<805-exec-run
>&"No source file named main.cpp.\n"
>802^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"main.cpp\":62",times="0",original-location="\"main.cpp\":62"}
>&"No source file named CMakeLists.txt.\n"
>804^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"CMakeLists.txt\":9",times="0",original-location="\"CMakeLists.txt\":9"}
>=thread-group-started,id="i1",pid="22825"
Создана группа потоков i1.
dПолучено уведомление от pid 22825
>=thread-created,id="1",group-id="i1"
Поток 1 создан.
>=thread-exited,id="1",group-id="i1"
Завершился поток 1 из группы i1.
>=thread-group-exited,id="i1"
Группа потоков i1 завершена.
dNOTE: INFERIOR EXITED
dState changed from EngineRunRequested(3) to InferiorShutdownFinished(13)
dState changed from InferiorShutdownFinished(13) to EngineShutdownRequested(14)
dCALL: SHUTDOWN ENGINE
dPLAIN ADAPTER SHUTDOWN 14
dINITIATE GDBENGINE SHUTDOWN, PROC STATE: 2
<806python theDumper.exitGdb({"token":806})
>805^error,msg="During startup program exited with code 127."
eERROR: UNEXPECTED STATE: EngineShutdownRequested WANTED: EngineRunRequested IN /opt/astra/qtcreator/qtcreator-6.0.2/src/plugins/debugger/gdb/gdbengine.cpp:4756
dDuring startup program exited with code 127.
dNOTE: ENGINE RUN FAILED
Запуск неудачно завершился.
dState changed from EngineShutdownRequested(14) to EngineRunFailed(4)
dState changed from EngineRunFailed(4) to EngineShutdownRequested(14)
dCALL: SHUTDOWN ENGINE
dPLAIN ADAPTER SHUTDOWN 14
dINITIATE GDBENGINE SHUTDOWN, PROC STATE: 2
<807python theDumper.exitGdb({"token":807})
>&"python theDumper.exitGdb({\"token\":806})\n"
dQUIT DEBUGGER REQUESTED IN STATE 14
dGDB PROCESS FINISHED, status 0, exit code 0 (0x0)
dNOTE: ENGINE SHUTDOWN FINISHED
dState changed from EngineShutdownRequested(14) to EngineShutdownFinished(15)
Отладчик завершился.
dState changed from EngineShutdownFinished(15) to DebuggerFinished(16)
Несколько раз писала ещё такие предупреждения:
warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device
warning: Could not trace the inferior process.Error:
warning: ptrace: Operation not permitted
Как всё-таки запустить отладку в QtCreator?
Ответы (2 шт):
Под Астрой не работал, но под бубунтой решается прописыванием в /etc/sysctl.d/10-ptrace.conf kernel.yama.ptrace_scope = 0
Удалось решить по совету отсюда:
Есть небольшая трудность только с первоначальным запуском из-за особенностей настройки безопасности Astra Linux. Из коробки в ОС включена блокировка трассировки
ptrace
. Работает одно из встроенных средств защиты информации. Для его отключения переходим в терминал и прописываемastra-ptrace-lock disable
, далее проверяем, что всё прошло успешно командойsystemctl is-enabled astra-ptrace-lock
. Должно появиться сообщениеdisabled
.