From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31835 invoked by alias); 8 Mar 2004 22:58:36 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 31816 invoked from network); 8 Mar 2004 22:58:34 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 8 Mar 2004 22:58:34 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i28MwWST030367 for ; Mon, 8 Mar 2004 17:58:33 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i28MwUM00636; Mon, 8 Mar 2004 17:58:30 -0500 Received: from redhat.com (dhcp-172-16-25-160.sfbay.redhat.com [172.16.25.160]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i28MwTR08999; Mon, 8 Mar 2004 14:58:29 -0800 Message-ID: <404CFA95.30204@redhat.com> Date: Mon, 08 Mar 2004 22:58:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.4) Gecko/20030922 MIME-Version: 1.0 To: jim.houston@comcast.net CC: gdb-patches@sources.redhat.com Subject: Re: [patch] allow switching stacks References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-RedHat-Spam-Score: -4.9 X-SW-Source: 2004-03.o/txt/msg00182.txt Jim Houston wrote: > 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 Good idea, and nice implementation. My only suggestions are in the user interface realm. I'm thinking something like "non-contiguous stacks" would be more meaningful than "multiple stacks" (there's really still only one stack, it's just broken into two segments). Same goes for switch-stacks; it's a bit non-intuitive to me. segmented-stack? discontiguous-stack? > > 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\ > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31835 invoked by alias); 8 Mar 2004 22:58:36 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 31816 invoked from network); 8 Mar 2004 22:58:34 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 8 Mar 2004 22:58:34 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i28MwWST030367 for ; Mon, 8 Mar 2004 17:58:33 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i28MwUM00636; Mon, 8 Mar 2004 17:58:30 -0500 Received: from redhat.com (dhcp-172-16-25-160.sfbay.redhat.com [172.16.25.160]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i28MwTR08999; Mon, 8 Mar 2004 14:58:29 -0800 Message-ID: <404CFA95.30204@redhat.com> Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.4) Gecko/20030922 MIME-Version: 1.0 To: jim.houston@comcast.net CC: gdb-patches@sources.redhat.com Subject: Re: [patch] allow switching stacks References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-RedHat-Spam-Score: -4.9 X-SW-Source: 2004-03/txt/msg00182.txt.bz2 Message-ID: <20040319000900.wj4cPv0pP0Lyj4lj41xvTcGgRhnrY4Au58xSxFXS_SQ@z> Jim Houston wrote: > 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 Good idea, and nice implementation. My only suggestions are in the user interface realm. I'm thinking something like "non-contiguous stacks" would be more meaningful than "multiple stacks" (there's really still only one stack, it's just broken into two segments). Same goes for switch-stacks; it's a bit non-intuitive to me. segmented-stack? discontiguous-stack? > > 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\ >