This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH] Add panic tapset
- From: "Bryn M. Reeves" <bmr at redhat dot com>
- To: Systemtap List <systemtap at sourceware dot org>
- Date: Mon, 18 Jun 2012 19:04:31 +0100
- Subject: Re: [PATCH] Add panic tapset
- References: <4FDF6BC0.80608@redhat.com>
On 06/18/2012 06:56 PM, Bryn M. Reeves wrote:
> This patch adds a tapset with a single function to call the native
> panic() routine. This is useful in order to trigger a core dump to
> collect post-mortem debugging data when some condition occurs.
Oops, that was the RHEL6 version of the patch (with THIS->var notation).
Attached is the patch against current master.
Regards,
Bryn.
>From 0ed09a45bb6c071bb330a6c8538d73722104bc0c Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Mon, 18 Jun 2012 19:02:53 +0100
Subject: [PATCH] Add panic tapset
Add a tapset to expose the kernel's panic() routine.
---
tapset/panic.stp | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
create mode 100644 tapset/panic.stp
diff --git a/tapset/panic.stp b/tapset/panic.stp
new file mode 100644
index 0000000..6fd69a9
--- /dev/null
+++ b/tapset/panic.stp
@@ -0,0 +1,32 @@
+// Copyright (C) 2012 Red Hat Inc., Bryn M. Reeves <bmr@redhat.com>
+//
+// This file is part of systemtap, and is free software. You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+//
+
+// <tapsetdescription>
+// Functions in the panic tapset allow a probe handler to invoke
+// the system panic routine with a user-specified message.
+//
+// This may be used with a crash dump collection facility such as
+// kexec/kdump in order to capture data for post-mortem debugging.
+//
+// Due to the fact that this will bring the system to an immediate
+// halt the functions in this tapset require guru mode.
+// </tapsetdescription>
+
+/**
+ * sfunction panic - trigger a panic
+ * @msg: message to pass to kernel's panic() function
+ *
+ * Description: this function triggers an immediate panic of the running
+ * kernel with a user-specified panic message.
+ * It requires guru mode.
+ */
+function panic(msg:string) %{
+ /* guru */
+ panic("%s", STAP_ARG_msg);
+%}
+
--
1.7.6.5