Linux: 如何设置gdb和可执行文件之间的关联?
Linux: How to setup association between gdb and executables?
我希望启用某些程序(如我自己的 prog1、prog2 等)由 linux 作为服务守护程序启动或在 [=20= 内启动时的功能], gdb 会自动启动 运行 这些程序。
在 windows 我可以使用 gflags 将可执行文件与调试器相关联。如何在 linux 上执行此操作?我 运行宁 ubuntu 16.04
谢谢!
您可以考虑编写一个简单的包装器以在启动守护进程后自动 运行 gdb。
请查看man gdb
。
You can, instead, specify a process ID as a second argument, if you want to debug a running process:
gdb program 1234
would attach GDB to process 1234 (unless you also have a file named 1234; GDB does check for a core file first).
我希望启用某些程序(如我自己的 prog1、prog2 等)由 linux 作为服务守护程序启动或在 [=20= 内启动时的功能], gdb 会自动启动 运行 这些程序。
在 windows 我可以使用 gflags 将可执行文件与调试器相关联。如何在 linux 上执行此操作?我 运行宁 ubuntu 16.04
谢谢!
您可以考虑编写一个简单的包装器以在启动守护进程后自动 运行 gdb。
请查看man gdb
。
You can, instead, specify a process ID as a second argument, if you want to debug a running process:
gdb program 1234
would attach GDB to process 1234 (unless you also have a file named 1234; GDB does check for a core file first).