lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 3 Sep 2009 21:25:59 -0400
From:	Amerigo Wang <amwang@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>,
	akpm@...ux-foundation.org, linux-kbuild@...r.kernel.org,
	Amerigo Wang <amwang@...hat.com>,
	Sam Ravnborg <sam@...nborg.org>
Subject: [Patch 4/5] scripts: add gen_gcov.sh


Add scripts/gen_gcov.sh which will be used by the later patch.
It is used to generate .gcov file from .c file.

Signed-off-by: WANG Cong <amwang@...hat.com>

---
Index: linux-2.6/scripts/gen_gcov.sh
===================================================================
--- /dev/null
+++ linux-2.6/scripts/gen_gcov.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# WANG Cong <xiyou.wangcong@...il.com>
+# GPLv2 applies.
+
+GCOV_BASE=/sys/kernel/debug/gcov$(readlink /lib/modules/`uname -r`/build)
+target=""
+trap  "rm -f *.gcov" INT
+
+function usage()
+{
+	echo "$0 [GCOV_BASE_DIR] target_file.c"
+	echo "The default directory is: /sys/kernel/debug/gcov/path/to/compile."
+}
+
+if [ $# -eq 2 ];
+then
+	GCOV_BASE="$1"
+	target="$2"
+elif [ $# -eq 1 ];
+then
+	target="$1"
+	if [ ! -d "$GCOV_BASE" ];
+	then
+		echo "You have to provide the base directory for gcov." >&2
+		exit 1
+	fi
+else
+	usage
+	exit 1
+fi
+
+if [ ! -f "$target" ];
+then
+	echo "File $target doesn't exist.\n" 1>&2
+	exit 1
+fi
+
+target_base_name=$(basename "$target")
+target_dir_name=$(dirname "$target")
+
+${GCOV} -o "$GCOV_BASE/$target_dir_name" "$target_base_name"
+if [ -f "${target_base_name}.gcov" ];
+then
+	mv *.gcov "$target_dir_name"
+	exit 0
+else
+	exit 1
+fi
+
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ