修改handler写coredump大文件分块写入降低内存使用

This commit is contained in:
linxin
2023-05-19 18:12:17 +08:00
parent 9ca3746fce
commit ccc9eea97b
2 changed files with 69 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
package main
//#cgo CXXFLAGS: -std=c++11
// #cgo CFLAGS: -I /root/breakpad/src/tools/linux/core_handler/coredump_handler_wrapper
// #cgo LDFLAGS: /root/breakpad/src/tools/linux/core_handler/coredump_handler_wrapper/coredump_handler_wrapper.so
//#include "/root/breakpad/src/tools/linux/core_handler/coredump_handler_wrapper/coredump_handler_wrapper.h"
import "C"
import "fmt"
func HandleCrash(pid int, procfsDir string, mdFilename string) bool {
fmt.Println("start")
return bool(C.HandleCrash(C.pid_t(pid), C.CString(procfsDir), C.CString(mdFilename)))
}
func main() {
// 调用 coredump_handler_wrapper 动态链接库中的 HandleCrash 函数
HandleCrash(123, "/proc/123", "/var/tmp")
}