From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31413 invoked by alias); 5 Apr 2010 15:51:18 -0000 Received: (qmail 31401 invoked by uid 22791); 5 Apr 2010 15:51:16 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Apr 2010 15:51:09 +0000 Received: (qmail 28029 invoked from network); 5 Apr 2010 15:51:07 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Apr 2010 15:51:07 -0000 Date: Mon, 05 Apr 2010 15:51:00 -0000 From: Daniel Jacobowitz To: =?utf-8?B?SsOhbiBTdGFuxI1law==?= Cc: gdb-patches@sourceware.org Subject: Re: patch: fix stack unwind through uClibc syscall() on mips Message-ID: <20100405155102.GA23667@caradoc.them.org> Mail-Followup-To: =?utf-8?B?SsOhbiBTdGFuxI1law==?= , gdb-patches@sourceware.org References: <737ad3551003271055o91a78i3f5ff305b927e441@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <737ad3551003271055o91a78i3f5ff305b927e441@mail.gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-04/txt/msg00075.txt.bz2 On Sat, Mar 27, 2010 at 06:55:18PM +0100, Ján Stanček wrote: > uClibc syscall() is macro which modifies stack before syscall > instruction, gdb is only looking at function prologue and misses the > stack modification made in syscall(). Because of this unwind doesn't > work. Attached is a patch, which is looking at actual $pc and $pc-4, > and in case of syscall it modifies $sp, so mip32_scan_prologue finds > correct values. > > Description of bug is also available here: > http://www.listware.net/201003/gnu-gdb/26893.html Have you considered just annotating the syscall routine with DWARF-2 tables? That's how GLIBC solves this problem. And it doesn't take up any space in a stripped binary. [Hmm, good wiki topic?] It looks like this patch detects the syscall instruction followed by a single instruction that adjusts sp. It will break if the opposite SP adjustment was already found by the prologue analyzer. -- Daniel Jacobowitz CodeSourcery