linux-mips
[Top] [All Lists]

Re: [PATCH] Make mips-linux signal frame unwinding more robust.

To: gdb-patches@sourceware.org
Subject: Re: [PATCH] Make mips-linux signal frame unwinding more robust.
From: David Daney <ddaney@caviumnetworks.com>
Date: Fri, 26 Feb 2010 10:22:09 -0800
Cc: Joel Brobecker <brobecker@adacore.com>, "Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com>, Ralf Baechle <ralf@linux-mips.org>, linux-mips <linux-mips@linux-mips.org>
In-reply-to: <4B86C5EB.6090303@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <4B82CEC4.2010607@caviumnetworks.com> <20100225174739.GA2851@adacore.com> <4B86C5EB.6090303@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc12 Thunderbird/3.0.1
On 02/25/2010 10:48 AM, David Daney wrote:
On 02/25/2010 09:47 AM, Joel Brobecker wrote:
[...]

I don't know mips-linux, but something looked funny to me: You avoid
the use of SIGFRAME_CODE_OFFSET to compute the address where the
sigcontext
structure is located, but you still use it to compute the frame base
address (used when building the frame ID). Is the frame base address
still a constant offset from FUNC, or does the frame ID base address
also needs to be changed.

Right, I missed that part. When it started working, I stopped patching.
I will take another look at that part.



Here is the revised patch fixing the issue Joel noted.

From the original message:

  The current signal frame unwinding code in mips-linux-tdep.c assumes
  a constant offset from the signal return trampoline to the signal
  frame. The assumption does not hold for all kernels.  Specifically
  those that have to be compiled with ICACHE_REFILLS_WORKAROUND_WAR
  set (SGI O2 for example).  In the near future, it is likely that the
  assumption will cease to hold universally, as we are attempting to
  move the signal return trampoline off the stack entirely.

  The libgcc unwinder already gets this right by using the signal
  frame's SP to locate the sigcontext.

  This patch makes gdb follow suit and find the sigcontext_base using
  the signal frame's SP rather than an offset from the trampoline.

Tested on mips64-linux with no regressions (and more than 100
improvements).

OK to commit?

How about on the 7.1 branch?


2010-02-26  David Daney  <ddaney.caviumnetworks.com>

        * mips-linux-tdep.c: Update struct sigframe comments.
        (SIGFRAME_CODE_OFFSET): Delete macro.
        (mips_linux_o32_sigframe_init): Calculate sigcontext_base using
        this_frame's sp.
        (mips_linux_n32n64_sigframe_init): Same.

Attachment: gdb.patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>