linux安装gdb命令,Linux gdb 命令 command not found gdb 命令详解 gdb 命令未找到 gdb 命令安装 - CommandNotFound ⚡️ 坑否...

显示行号

|

选择喜欢的代码风格

默认

GitHub

Dune

LakeSide

Plateau

Vibrant

Blue

Eighties

Tranquil

gdb 命令是 GNU 调试器,支持 Ada、C、C++、Objective-C、Pascal 等语言。

gdb 命令安装:

-bash/zsh: gdb command not found

#Debian

apt-get install gdb

#Ubuntu

apt-get install gdb

#Alpine

apk add gdb

#Arch Linux

pacman -S gdb

#Kali Linux

apt-get install gdb

#CentOS

yum install gdb

#Fedora

dnf install gdb

#OS X

brew install gdb

#Raspbian

apt-get install gdb

#Docker

docker run cmd.cat/gdb gdb

gdb 命令补充说明:

GNU 调试器 gdb 是一种宝贵的工具,可用于在开发程序时检查正在运行的进程并解决问题。设置断点是学习使用 GNU 调试器的第一步。程序在达到断点时停止,你可以运行 gdb 的命令对其进行检查或更改变量,然后再允许该程序继续运行。

gdb 命令语法:

gdb

[-help] [-nx] [-q] [-batch] [-cd=dir] [-f] [-b bps] [-tty=dev] [-s symfile] [-e prog] [-se prog] [-c core] [-x cmds] [-d dir] [prog[core|procID]]

gdb 命令选项:

-help

-h

List all options, with brief explanations.

-symbols=file

-s file

Read symbol table from file file.

-write

Enable writing into executable and core files.

-exec=file

-e file

Use file file as the executable file to execute when appropriate, and for examining pure data in conjunction with a core dump.

-se=file

Read symbol table from file file and use it as the executable file.

-core=file

-c file

Use file file as a core dump to examine.

-command=file

-x file

Execute GDB commands from file file.

-directory=directory

-d directory

Add directory to the path to search for source files.

-nx

-n

Do not execute commands from any '.gdbinit' initialization files. Normally, the commands in these files are executed after all the command options and arguments have been processed.

-quiet

-q

''Quiet''. Do not print the introductory and copyright messages. These messages are also suppressed in batch mode.

-batch

Run in batch mode. Exit with status 0 after processing all the command files specified with '-x' (and '.gdbinit', if not inhibited). Exit with nonzero status if an error occurs in executing the GDB commands in the command files.

Batch mode may be useful for running GDB as a filter, for example to download and run a program on another computer; in order to make this more useful, the message

Program exited normally.

(which is ordinarily issued whenever a program running under GDB control terminates) is not issued when running in batch mode.

-cd=directory

Run GDB using directory as its working directory, instead of the current directory.

-fullname

-f

Emacs sets this option when it runs GDB as a subprocess. It tells GDB to output the full file name and line number in a standard, recognizable fashion each time a stack frame is displayed (which includes each time the program stops). This recognizable format looks like two ' 32' characters, followed by the file name, line number and character position separated by colons, and a newline. The Emacs-to-GDB interface program uses the two ' 32' characters as a signal to display the source code for the frame.

-b bps

Set the line speed (baud rate or bits per second) of any serial interface used by GDB for remote debugging.

-tty=device

Run using device for your program's standard input and output.

gdb 命令实例:

gdb 调试可执行文件:

gdb executable

将进程附加到 gdb:

gdb -p procID

启动时执行给定的 GDB 命令:gdb -ex "commands" executable

启动 gdb 并传递参数:

gdb --args executable argument1 argument2

gdb 命令扩展阅读:

gdb 命令评论

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值