From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21198 invoked by alias); 7 Aug 2009 15:50:08 -0000 Received: (qmail 21184 invoked by uid 22791); 7 Aug 2009 15:50:07 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_83 X-Spam-Check-By: sourceware.org Received: from kz-easy.com (HELO almaty.kz-easy.com) (85.214.25.173) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Aug 2009 15:50:01 +0000 Received: from alatau.radix50.net (dslb-092-074-050-251.pools.arcor-ip.net [92.74.50.251]) (authenticated bits=0) by almaty.kz-easy.com (8.13.8/8.13.8/Debian-3) with ESMTP id n77FntCb008728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 7 Aug 2009 17:49:56 +0200 Received: from alatau.radix50.net (localhost [127.0.0.1]) by alatau.radix50.net (8.14.3/8.14.3/Debian-5) with ESMTP id n77Fnnc0008540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 7 Aug 2009 17:49:49 +0200 Received: (from ibr@localhost) by alatau.radix50.net (8.14.3/8.14.3/Submit) id n77FnnHn008539; Fri, 7 Aug 2009 17:49:49 +0200 Date: Fri, 07 Aug 2009 16:07:00 -0000 From: Baurzhan Ismagulov To: gdb-patches@sourceware.org Cc: gdb@sourceware.org Subject: Re: syscall backtraces on arm-linux-gnu Message-ID: <20090807154949.GC28041@radix50.net> Mail-Followup-To: gdb-patches@sourceware.org, gdb@sourceware.org References: <20090805160852.GA25684@radix50.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090805160852.GA25684@radix50.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes 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: 2009-08/txt/msg00110.txt.bz2 Hello, I'm taking this to gdb-patches. On Wed, Aug 05, 2009 at 06:08:52PM +0200, Baurzhan Ismagulov wrote: > I can't get gdb 6.8.50.20090804 to print complete backtraces on > arm-linux-gnu. ... > (gdb) bt > #0 0x400e16c8 in select () from /lib/libc.so.6 > #1 0x00000000 in ?? () > > I stopped on select and stepped through the instructions. The function > starts like this: > insn mnemonic > push {lr} > ... 1a000007 bne 0x400e16dc > push {r4} > ... > svc 0x0090008e > pop {r4} > ... > > I've seen that bt starts showing incorrect results after the second > push It turned out that select is implemented in assembly in glibc, so no CFI is provided and gdb falls back to prologue analysis. The following hack fixes the use case for me: diff -Naurp -X /opt/ibr/bin/dontdiff.ibr -X dontdiff.prj gdb-6.8.50.20090804.orig/gdb/arm-tdep.c gdb-6.8.50.20090804/gdb/arm-tdep.c --- gdb-6.8.50.20090804.orig/gdb/arm-tdep.c 2009-07-31 01:05:04.000000000 +0200 +++ gdb-6.8.50.20090804/gdb/arm-tdep.c 2009-08-07 17:26:10.000000000 +0200 @@ -891,12 +891,14 @@ arm_scan_prologue (struct frame_info *th regs[ARM_IP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -imm); continue; } - else if (insn == 0xe52de004) /* str lr, [sp, #-4]! */ + else if ((insn & 0xffff0000) == 0xe52d0000) /* str rx, [sp, #-4]! */ { + unsigned reg = (insn & 0xf000) >> 12; if (pv_area_store_would_trash (stack, regs[ARM_SP_REGNUM])) break; regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -4); - pv_area_store (stack, regs[ARM_SP_REGNUM], 4, regs[ARM_LR_REGNUM]); + if (reg == ARM_LR_REGNUM) + pv_area_store (stack, regs[ARM_SP_REGNUM], 4, regs[ARM_LR_REGNUM]); continue; } else if ((insn & 0xffff0000) == 0xe92d0000) @@ -988,8 +990,6 @@ arm_scan_prologue (struct frame_info *th regs[fp_start_reg++]); } } - else if ((insn & 0xf0000000) != 0xe0000000) - break; /* Condition not true, exit early */ else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */ break; /* Don't scan past a block load */ else The first hunk handles pushes of any register, not just lr; the second one prevents early exit on a jump (see disassembly above). What do you think? Meanwhile, I will see whether I can get the testsuite to work on arm. Thanks in advance, -- Baurzhan Ismagulov http://www.kz-easy.com/