GDB usage
gcc parameter
shell gcc -g something.c -o something // "-g" means debug informations added // source code will be added to the onbjected file
Mac OS configuration
"please check gdb is codesigned - see taskgated(8)"
This error occurs because OSX implements a pid access policy which requires a digital signature for binaries to access other processes pids. To enable gdb access to other processes, we must first code sign the binary. This signature depends on a particular certificate, which the user must create and register with the system.
先创建一个文件 gdb-entitlement.xml,内容为: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.cs.debugger</key> <true/> </dict> </plist> </pre> 再执行: codesign --entitlements gdb-entitlement.xml -fs gdb-cert $(which gdb)
command
``shell lay next: CLT interface
``