From: Jim Houston <jim.houston@comcast.net>
To: gdb-patches@sources.redhat.com
Subject: [patch] allow switching stacks
Date: Mon, 08 Mar 2004 18:06:00 -0000 [thread overview]
Message-ID: <m3y8qbp650.fsf@new.localdomain> (raw)
Hi Everyone,
This patch against gdb-6.0 adds an option to disable an error check
which reports a non-contiguous stack as corrupted. I need this
option to get a reliable stack trace using kgdb on the x86-64 Linux
kernel because it uses a separate per-processor interrupt stack.
This option is enabled with:
set backtrace switch-stacks on
Jim Houston - Concurrent Computer Corp.
-
diff -urN old/gdb-6.0/gdb/frame.c new/gdb-6.0/gdb/frame.c
--- old/gdb-6.0/gdb/frame.c 2003-12-31 15:27:45.866840920 -0500
+++ new/gdb-6.0/gdb/frame.c 2003-12-31 15:27:58.310949128 -0500
@@ -138,6 +138,7 @@
/* Flag to indicate whether backtraces should stop at main et.al. */
static int backtrace_past_main;
+static int backtrace_switch_stacks;
static unsigned int backtrace_limit = UINT_MAX;
@@ -1971,7 +1972,7 @@
the next frame. This happens when a frame unwind goes backwards.
Since the sentinel frame doesn't really exist, don't compare the
inner-most against that sentinel. */
- if (this_frame->level > 0
+ if (!backtrace_switch_stacks && this_frame->level > 0
&& frame_id_inner (get_frame_id (this_frame),
get_frame_id (this_frame->next)))
error ("Previous frame inner to this frame (corrupt stack?)");
@@ -2461,6 +2462,19 @@
NULL, NULL, &set_backtrace_cmdlist,
&show_backtrace_cmdlist);
+ add_setshow_boolean_cmd ("switch-stacks", class_obscure,
+ &backtrace_switch_stacks, "\
+Set if thread may use multiple stacks. This flag disables checks in\n\
+the stack trace which expect that the stack grew in a consistent direction.\n\
+This option is needed for kernel debug when the kernel has separate\n\
+process and interrupt stacks.", "\
+Show if thread may use multiple stacks. This flag disables checks in\n\
+the stack trace which expect that the stack grew in a consistent direction.\n\
+This option is needed for kernel debug when the kernel has separate\n\
+process and interrupt stacks.",
+ NULL, NULL, &set_backtrace_cmdlist,
+ &show_backtrace_cmdlist);
+
add_setshow_uinteger_cmd ("limit", class_obscure,
&backtrace_limit, "\
Set an upper bound on the number of backtrace levels.\n\
WARNING: multiple messages have this Message-ID
From: Jim Houston <jim.houston@comcast.net>
To: gdb-patches@sources.redhat.com
Subject: [patch] allow switching stacks
Date: Fri, 19 Mar 2004 00:09:00 -0000 [thread overview]
Message-ID: <m3y8qbp650.fsf@new.localdomain> (raw)
Message-ID: <20040319000900.zlKyXXDMiw4_DScYZ95U52VxsSmC_jrloKAUE0cF8kM@z> (raw)
Hi Everyone,
This patch against gdb-6.0 adds an option to disable an error check
which reports a non-contiguous stack as corrupted. I need this
option to get a reliable stack trace using kgdb on the x86-64 Linux
kernel because it uses a separate per-processor interrupt stack.
This option is enabled with:
set backtrace switch-stacks on
Jim Houston - Concurrent Computer Corp.
-
diff -urN old/gdb-6.0/gdb/frame.c new/gdb-6.0/gdb/frame.c
--- old/gdb-6.0/gdb/frame.c 2003-12-31 15:27:45.866840920 -0500
+++ new/gdb-6.0/gdb/frame.c 2003-12-31 15:27:58.310949128 -0500
@@ -138,6 +138,7 @@
/* Flag to indicate whether backtraces should stop at main et.al. */
static int backtrace_past_main;
+static int backtrace_switch_stacks;
static unsigned int backtrace_limit = UINT_MAX;
@@ -1971,7 +1972,7 @@
the next frame. This happens when a frame unwind goes backwards.
Since the sentinel frame doesn't really exist, don't compare the
inner-most against that sentinel. */
- if (this_frame->level > 0
+ if (!backtrace_switch_stacks && this_frame->level > 0
&& frame_id_inner (get_frame_id (this_frame),
get_frame_id (this_frame->next)))
error ("Previous frame inner to this frame (corrupt stack?)");
@@ -2461,6 +2462,19 @@
NULL, NULL, &set_backtrace_cmdlist,
&show_backtrace_cmdlist);
+ add_setshow_boolean_cmd ("switch-stacks", class_obscure,
+ &backtrace_switch_stacks, "\
+Set if thread may use multiple stacks. This flag disables checks in\n\
+the stack trace which expect that the stack grew in a consistent direction.\n\
+This option is needed for kernel debug when the kernel has separate\n\
+process and interrupt stacks.", "\
+Show if thread may use multiple stacks. This flag disables checks in\n\
+the stack trace which expect that the stack grew in a consistent direction.\n\
+This option is needed for kernel debug when the kernel has separate\n\
+process and interrupt stacks.",
+ NULL, NULL, &set_backtrace_cmdlist,
+ &show_backtrace_cmdlist);
+
add_setshow_uinteger_cmd ("limit", class_obscure,
&backtrace_limit, "\
Set an upper bound on the number of backtrace levels.\n\
next reply other threads:[~2004-03-08 18:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-08 18:06 Jim Houston [this message]
2004-03-08 22:58 ` Michael Snyder
2004-03-19 0:09 ` Eli Zaretskii
2004-03-09 6:06 ` Eli Zaretskii
2004-03-19 0:09 ` Michael Snyder
2004-03-09 20:21 ` Andrew Cagney
2004-03-19 0:09 ` Andrew Cagney
2004-04-02 22:06 ` Andrew Cagney
2004-04-09 22:40 ` Daniel Jacobowitz
2004-04-12 21:05 ` Jim Blandy
2004-04-12 21:13 ` Daniel Jacobowitz
2004-03-19 0:09 ` Jim Houston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3y8qbp650.fsf@new.localdomain \
--to=jim.houston@comcast.net \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox