From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24028 invoked by alias); 4 Sep 2014 08:59:11 -0000 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 Received: (qmail 24007 invoked by uid 89); 4 Sep 2014 08:59:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Sep 2014 08:59:03 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1XPSsd-0001PC-SK from Yao_Qi@mentor.com ; Thu, 04 Sep 2014 01:58:59 -0700 Received: from GreenOnly (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Thu, 4 Sep 2014 01:58:59 -0700 From: Yao Qi To: Doug Evans CC: , , Subject: Re: [PATCH] Remove some obfuscation from ${arch}_skip_prologue functions References: Date: Thu, 04 Sep 2014 08:59:00 -0000 In-Reply-To: (Doug Evans's message of "Tue, 2 Sep 2014 16:53:00 -0700") Message-ID: <87ha0ndaub.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00107.txt.bz2 Doug Evans writes: > 1) There's no need to call find_pc_partial_function before > calling skip_prologue_using_sal: The first thing skip_prologue_using_sal > does is call find_pc_partial_function! Nowadays we have: if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) { CORE_ADDR post_prologue_pc =3D skip_prologue_using_sal (gdbarch, func_addr); if (post_prologue_pc !=3D 0) return max (pc, post_prologue_pc); } so your statement is valid if PC equals to FUNC_ADDR. I don't have a case that PC and FUNC_ADDR are different, but I'd like to add an assert to check this, in each target's implementation of skip_prologue hook, or in the callers of gdbarch_skip_prologue, something like: if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) gdb_assert (pc =3D=3D func_addr); Note that this assert is triggered on arm in gdb.cp/re-set-overloaded.exp, that is PC is [1] but FUNC_ADDR is [2]. (gdb) disassemble _ZN1CC1Ei Dump of assembler code for function _ZN1CC1Ev: 0x0000090c <+0>: ldr r12, [pc, #4] ; 0x918 <_ZN1CC1Ev+12> <-= [2] 0x00000910 <+4>: add r12, r12, pc 0x00000914 <+8>: bx r12 0x00000918 <+12>: ; instruction: 0xffffff= c5 0x0000091c <+0>: ldr r12, [pc, #4] ; 0x928 <_ZN1CC1Ei+12> <-= [1] 0x00000920 <+4>: add r12, r12, pc AFAICS, PC is still the function address but find_pc_partial_function computes the FUNC_ADDR incorrectly and it is nothing wrong about your patch. > nios2: yao@codesourcery.com I tested your patch on nios2-linux, and no regression is found. > tic6x:yao@codesourcery.com My c6x board is dead in data center, so I can't test this patch for it. --=20 Yao (=E9=BD=90=E5=B0=A7)