This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: patch: fix stack unwind through uClibc syscall() on mips
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: JÃn StanÄek <jan dot stancek at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 5 Apr 2010 11:51:05 -0400
- Subject: Re: patch: fix stack unwind through uClibc syscall() on mips
- References: <737ad3551003271055o91a78i3f5ff305b927e441@mail.gmail.com>
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