From bc23c3ecd1a8e523ea385068c8ce618c8309b274 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Tue, 13 Oct 2020 11:21:40 -0400 Subject: gnu: Add libleak. * gnu/packages/debug.scm (libleak): New variable. --- gnu/packages/debug.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'gnu') diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm index b55a4010e3..9041cac4e2 100644 --- a/gnu/packages/debug.scm +++ b/gnu/packages/debug.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2019 Pkill -9 ;;; Copyright © 2020 Vincent Legoll ;;; Copyright © 2020 Morgan Smith +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,6 +37,7 @@ #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages bison) + #:use-module (gnu packages c) #:use-module (gnu packages code) #:use-module (gnu packages compression) #:use-module (gnu packages flex) @@ -649,6 +651,53 @@ fun.") program to produce symbolic backtraces.") (license license:expat)))) +(define-public libleak + (package + (name "libleak") + (version "0.3.5") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/WuBingzheng/libleak") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1p8mb0hcfp8hdv1klv6rrpkn2zlhjxgkxbbjsk8kszxv7ijln87d")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ;no test suite + #:parallel-build? #f ;jobserver unavailable + #:phases (modify-phases %standard-phases + (add-after 'unpack 'unbundle-libwuya + (lambda _ + (substitute* "Makefile" + ((".*make -C libwuya.*") "")) + #t)) + (add-before 'build 'set-CC + (lambda _ + (setenv "CC" "gcc") + #t)) + (delete 'configure) ;no configure script + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (install-file "libleak.so" (string-append out "/lib")) + #t)))))) + (inputs `(("libbacktrace" ,libbacktrace) + ("libwuya" ,libwuya))) + (home-page "https://github.com/WuBingzheng/libleak") + (synopsis "Memory leaks detection tool") + (description "The libleak tool detects memory leaks by hooking memory +functions such as @code{malloc}. It comes as a shared object to be pre-loaded +via @code{LD_PRELOAD} when launching the application. It prints the full call +stack at suspicious memory leak points. Modifying or recompiling the target +program is not required, and the detection can be enabled or disabled while +the target application is running. The overhead incurred by libleak is +smaller than that of other tools such as Valgrind, and it aims to be easier to +use than similar tools like @command{mtrace}.") + (license license:gpl2+))) + (define-public mspdebug (package (name "mspdebug") -- cgit v1.2.3