guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: gnu: Add libleak.


From: guix-commits
Subject: 03/03: gnu: Add libleak.
Date: Tue, 13 Oct 2020 22:28:24 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit bc23c3ecd1a8e523ea385068c8ce618c8309b274
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Tue Oct 13 11:21:40 2020 -0400

    gnu: Add libleak.
    
    * gnu/packages/debug.scm (libleak): New variable.
---
 gnu/packages/debug.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index b55a401..9041cac 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; 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")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]