Ubuntu 22.04下CodeBlocks GDB调试器无法运行求助
Ubuntu 22.04.2 LTS下CodeBlocks GDB调试失败求助
我在Ubuntu 22.04.2 LTS系统中写了一个简单的Hello World程序,命令行下能正常运行,但在CodeBlocks中使用GDB调试时,程序启动即退出(退出代码1)。调试日志显示系统找不到/dev/?终端设备,而且不管运行什么程序都会出现这个问题,我怀疑是CodeBlocks的权限问题,希望能得到解决办法。
程序代码
#include <stdio.h> int main() { printf("Hello World"); return 0; }
调试日志
Active debugger config: GDB/CDB debugger:Default Building to ensure sources are up-to-date Selecting target: Debug Adding source dir: /home/gaezvr/Desktop/j/ Adding source dir: /home/gaezvr/Desktop/j/ Adding file: /home/gaezvr/Desktop/j/bin/Debug/j Changing directory to: /home/gaezvr/Desktop/j/. Set variable: LD_LIBRARY_PATH=.: [debug]Command-line: /usr/bin/gdb -nx -fullname -quiet -args /home/gaezvr/Desktop/j/bin/Debug/j [debug]Working dir : /home/gaezvr/Desktop/j Starting debugger: /usr/bin/gdb -nx -fullname -quiet -args /home/gaezvr/Desktop/j/bin/Debug/j Setting SHELL to '/bin/sh' done [debug]Reading symbols from /home/gaezvr/Desktop/j/bin/Debug/j... [debug](gdb) [debug]> set prompt >>>>>>>cb_gdb: Setting breakpoints [debug]Using terminal's PID as console PID 7991, TTY /dev/? [debug]Queued:[tty /dev/?] [debug]>>>>>>>cb_gdb: [debug]> show version [debug]GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 [debug]Copyright (C) 2022 Free Software Foundation, Inc. [debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> [debug]This is free software: you are free to change and redistribute it. [debug]There is NO WARRANTY, to the extent permitted by law. [debug]Type "show copying" and "show warranty" for details. [debug]This GDB was configured as "x86_64-linux-gnu". [debug]Type "show configuration" for configuration details. [debug]For bug reporting instructions, please see: [debug]<https://www.gnu.org/software/gdb/bugs/>. [debug]Find the GDB manual and other documentation resources online at: [debug] <http://www.gnu.org/software/gdb/documentation/>. [debug]For help, type "help". [debug]Type "apropos word" to search for commands related to "word". [debug]>>>>>>>cb_gdb: [debug]> set confirm off Debugger name and version: GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 [debug]>>>>>>>cb_gdb: [debug]> set width 0 [debug]>>>>>>>cb_gdb: [debug]> set height 0 [debug]>>>>>>>cb_gdb: [debug]> set breakpoint pending on [debug]>>>>>>>cb_gdb: [debug]> set print asm-demangle on [debug]>>>>>>>cb_gdb: [debug]> set unwindonsignal on [debug]>>>>>>>cb_gdb: [debug]> set print elements 200 [debug]>>>>>>>cb_gdb: [debug]> set disassembly-flavor intel [debug]>>>>>>>cb_gdb: [debug]> catch throw [debug]Catchpoint 1 (throw) [debug]>>>>>>>cb_gdb: [debug]> directory /home/gaezvr/Desktop/j/ [debug]Source directories searched: /home/gaezvr/Desktop/j:$cdir:$cwd [debug]>>>>>>>cb_gdb: [debug]> tty /dev/? [debug]>>>>>>>cb_gdb: [debug]> run [debug]/dev/?: No such file or directory. [debug]During startup program exited with code 1. [debug]Starting program: /home/gaezvr/Desktop/j/bin/Debug/j [debug]>>>>>>>cb_gdb: During startup program exited with code 1. [debug]> quit Debugger finished with status 0 DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS" Not using WSL as of I know.
调试过程中会弹出终端窗口。
内容的提问来源于stack exchange,提问作者M. Cousins The III
相关产品推荐
相关产品推荐

