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>] [day] [month] [year] [list]
Message-ID: <1448618675-198014-1-git-send-email-wangnan0@huawei.com>
Date:	Fri, 27 Nov 2015 10:04:35 +0000
From:	Wang Nan <wangnan0@...wei.com>
To:	<acme@...nel.org>, <adrian.hunter@...el.com>, <jolsa@...hat.com>
CC:	<linux-kernel@...r.kernel.org>, Wang Nan <wangnan0@...wei.com>,
	"Arnaldo Carvalho de Melo" <acme@...hat.com>,
	Zefan Li <lizefan@...wei.com>, <pi3orama@....com>
Subject: [PATCH] perf script: Add support for PERF_TYPE_BREAKPOINT

Useful for getting stack traces for hardware breakpoint events.

Test result:

Before this patch:
 # ~/perf record -g -e mem:0x600980 ./sample
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.011 MB perf.data (12 samples) ]

 # ~/perf script

 # ~/perf script -F comm,tid,pid,time,event,ip,sym,dso
 sample 22520/22520 97457.836294: mem:0x600980:
                   5a4ad8 __clear_user (/lib/modules/4.3.0-rc4+/build/vmlinux)
 ...
                   3f41ba sys_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
                   979395 return_from_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
             7f1b59719cf7 [unknown] ([unknown])

 sample 22520/22520 97457.836648: mem:0x600980:
                      532 main (/home/w00229757/DataBreakpoints/sample)
                    21bd5 __libc_start_main (/tmp/oxygen_root-root/lib64/libc-2.18.so)
 ...

After this patch:
 # ~/perf script
 sample 22520 97457.836294: mem:0x600980:
                   5a4ad8 __clear_user (/lib/modules/4.3.0-rc4+/build/vmlinux)
 ...
                   3f41ba sys_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
                   979395 return_from_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
             7f1b59719cf7 [unknown] ([unknown])

 sample 22520 97457.836648: mem:0x600980:
                      532 main (/home/w00229757/DataBreakpoints/sample)
                    21bd5 __libc_start_main (/tmp/oxygen_root-root/lib64/libc-2.18.so)

Signed-off-by: Wang Nan <wangnan0@...wei.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Zefan Li <lizefan@...wei.com>
Cc: pi3orama@....com
---
 tools/perf/builtin-script.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 3c3f8d0..d259e9a 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -130,6 +130,18 @@ static struct {
 
 		.invalid_fields = PERF_OUTPUT_TRACE,
 	},
+
+	[PERF_TYPE_BREAKPOINT] = {
+		.user_set = false,
+
+		.fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
+			      PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
+			      PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP |
+			      PERF_OUTPUT_SYM | PERF_OUTPUT_DSO |
+			      PERF_OUTPUT_PERIOD,
+
+		.invalid_fields = PERF_OUTPUT_TRACE,
+	},
 };
 
 static bool output_set_by_user(void)
@@ -1129,6 +1141,8 @@ static int parse_output_fields(const struct option *opt __maybe_unused,
 			type = PERF_TYPE_TRACEPOINT;
 		else if (!strcmp(str, "raw"))
 			type = PERF_TYPE_RAW;
+		else if (!strcmp(str, "break"))
+			type = PERF_TYPE_BREAKPOINT;
 		else {
 			fprintf(stderr, "Invalid event type in field string.\n");
 			rc = -EINVAL;
-- 
1.8.3.4

--
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