In Windows you can use a default debugger (gflag) that is called when a image name i开发者_如何学运维s run. Can be this done with GDB and Linux? In Windows it's useful for debugging services.
Regards.
There is no way to do this on Linux, short of hacking your kernel.
Nor is it usually necessary. If you always want to run e.g. /foo/bar
under GDB, just do this:
mv /foo/bar /foo/bar.x
cat > /foo/bar <<EOF
#!/bin/bash
exec gdb --args /foo/bar.x "$@"
EOF
chmod +x /foo/bar
Problem solved ;-)
yes, from the command line run:
gdb --args [program] [options]
精彩评论