- 下载deadlock.py
https://github.com/facebook/folly/blob/main/folly/experimental/gdb/deadlock.py
- 用gdb附加到死锁的程序
#include <iostream> | |
#include <sstream> | |
#include <fstream> | |
using namespace std; | |
int main() | |
{ | |
std::ofstream outfile; | |
outfile.open("example.txt", std::ios_base::app); // 以追加模式打开文件 |
https://github.com/facebook/folly/blob/main/folly/experimental/gdb/deadlock.py
xprop _NET_WM_PID | cut -d' ' -f3 |
#define m 16 | |
char buffer[m] = {0}; | |
int index = 0; | |
void fillBuffer(const char *buf, int n) | |
{ | |
if(index + n <= m) | |
{ | |
memcpy(buffer + index, buf, n); | |
index += n; |
#!/bin/sh | |
if test $# -ne 1; then | |
echo "Usage: `basename $0 .sh` <process-id>" 1>&2 | |
exit 1 | |
fi | |
if test ! -r /proc/$1; then | |
echo "Process $1 not found." 1>&2 | |
exit 1 | |
fi |