首页 > 解决方案 > shell 命令的 GDB 别名

问题描述

当我使用 gdb 时,我想通过运行 shell 脚本(例如“./scripts/build.sh”)来重建程序,所以我通过命令分配了别名:

alias build = 'shell ./scripts/build.sh'

但发生错误

Invalid command to alias to: shell ./scripts/build.sh

我应该怎么办 ?

标签: shellgdb

解决方案


alias定义一个新命令,它是现有命令的别名。shell ./scripts/build.sh不是和现有命令。

改为这样做:

(gdb) define build
> shell ./scripts/build.sh
> end

推荐阅读