From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13028 invoked by alias); 4 May 2008 09:05:42 -0000 Received: (qmail 13019 invoked by uid 22791); 4 May 2008 09:05:41 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 04 May 2008 09:05:23 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.1/8.14.1) with ESMTP id m4494DQc007182; Sun, 4 May 2008 11:04:13 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.1/8.14.1/Submit) id m4494C2X021017; Sun, 4 May 2008 11:04:12 +0200 (CEST) Date: Sun, 04 May 2008 11:53:00 -0000 Message-Id: <200805040904.m4494C2X021017@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: uweigand@de.ibm.com CC: gdb-patches@sourceware.org In-reply-to: <200805040043.m440hDtW000371@d12av02.megacenter.de.ibm.com> (uweigand@de.ibm.com) Subject: Re: [commit] Fix backtrace past "clone" on powerpc References: <200805040043.m440hDtW000371@d12av02.megacenter.de.ibm.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-05/txt/msg00164.txt.bz2 > Date: Sun, 4 May 2008 02:43:13 +0200 (CEST) > From: "Ulrich Weigand" > > Hello, > > backtrace in multi-threaded applications would tend to throw an error: > > where^M > #0 0x0fcfdb34 in sem_wait@GLIBC_2.0 () from /lib/libpthread.so.0^M > #1 0x100008f0 in spin (vp=0x0) at /home/uweigand/fsf/gdb-head/gdb/testsuite/gdb.threads/tls.c:97^M > #2 0x0fcf6764 in start_thread () from /lib/libpthread.so.0^M > #3 0x0ff2c604 in clone () from /lib/libc.so.6^M > Backtrace stopped: previous frame inner to this frame (corrupt stack?)^M > > because clone was not recognized to terminate the stack. > > The patch below fixes this by having rs6000_frame_this_id return the null > frame ID in that case (just like many other targets do already). Please think a bit more about this. Is base == 0 a strong enough condition on PowerPC? What happens if you have a buffer overflow that overwrites the piece of the stack where the stack pointer was saved with zero? Will the backtrace now terminate without printing an error? > diff -urNp gdb-orig/gdb/rs6000-tdep.c gdb-head/gdb/rs6000-tdep.c > --- gdb-orig/gdb/rs6000-tdep.c 2008-05-04 02:07:36.026688000 +0200 > +++ gdb-head/gdb/rs6000-tdep.c 2008-05-04 02:08:56.461342375 +0200 > @@ -2550,6 +2550,10 @@ rs6000_frame_this_id (struct frame_info > { > struct rs6000_frame_cache *info = rs6000_frame_cache (this_frame, > this_cache); > + /* This marks the outermost frame. */ > + if (info->base == 0) > + return; > + > (*this_id) = frame_id_build (info->base, get_frame_func (this_frame)); > } > > -- > Dr. Ulrich Weigand > GNU Toolchain for Linux on System z and Cell BE > Ulrich.Weigand@de.ibm.com >