Taking Smart Notes With Org-mode
  • About
  • Articles
  • Notes
  • Search
Home » Topics

GDB

January 18, 2021 · 1 min · Gray King
  • tags: C/C++,Programming Tools

Links to this note


    Use GDB to Debug Cgo Segmentation Fault

    tags: Go, GDB Enable Core Dumps ulimit -S -c unlimited Confirm or Change The Location of Core Dumps sysctl -w kernel.core_pattern=/tmp/core.%e.%p # Or echo '/tmp/core.%e.%p' | tee /proc/sys/kernel/core_pattern Set GOTRACEBACK Environment Variable to Let Go Program Core Dumps when Panic export GOTRACEBACK=crash Run Go Program and Wait Segmentation Fault Use GDB to Debug gdb /path/to/goprogram /tmp/core-xx-xx Then use thread apply all bt to see all backtraces, include compiled C code. Note: -g option should be applied to the compiled C code to generate debug symbols. ...

    April 5, 2023 · 1 min · Gray King

    macOS 签名 GDB

    tags: GDB,macOS macOS 下通过 GDB 调试程序会出现: Unable to find Mach task port for process-id 1375: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) 需要通过 Keychain Access Application 创建证书: code-sign-cert 需要对 gdb 进行签名,首先创建 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> 运行签名 codesign --entitlements gdb-entitlement.xml -fs code-sign-cert $(which gdb) See also: PermissionsDarwin。

    July 26, 2021 · 1 min · Gray King

    GDB 打出所有线程的 Backtrace

    tags: GDB thread apply all bt

    January 18, 2021 · 1 min · Gray King
© 2025 Taking Smart Notes With Org-mode · Powered by Hugo & PaperMod