Return-Path: Received: from mnm [127.0.0.1] by localhost with POP3 (fetchmail-5.9.0) for akpm@localhost (single-drop); Thu, 08 Jan 2004 17:54:39 -0800 (PST) Received: from fire-1.osdl.org (air1.pdx.osdl.net [172.20.0.5]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i091r1o18423 for ; Thu, 8 Jan 2004 17:53:01 -0800 Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id i091r0Av030132 for ; Thu, 8 Jan 2004 17:53:01 -0800 Received: from h00e098094f32.ne.client2.attbi.com ([24.60.234.83]) by comcast.net (rwcrmhc13) with ESMTP id <2004010901525401500b89aoe>; Fri, 9 Jan 2004 01:52:54 +0000 Received: by h00e098094f32.ne.client2.attbi.com (Postfix, from userid 500) id 6B592C60FC; Thu, 8 Jan 2004 20:52:33 -0500 (EST) To: Andrew Morton From: jim.houston@comcast.net Subject: gdb-switch-stacks.patch Message-Id: <20040109015233.6B592C60FC@h00e098094f32.ne.client2.attbi.com> Date: Thu, 8 Jan 2004 20:52:33 -0500 (EST) X-MIMEDefang-Filter: osdl$Revision: 1.45 $ X-Scanned-By: MIMEDefang 2.36 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on mnm X-Spam-Level: X-Spam-Status: No, hits=-4.6 required=2.0 tests=BAYES_00,NO_REAL_NAME autolearn=no version=2.60 Hi Andrew, This patch to gdb-6.0 adds an option to disable an error check which reports a non-contiguous stack as corrupted. This is needed to get a reliable stack trace using kgdb on Opteron because the kernel 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\