From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105212 invoked by alias); 25 Jun 2018 21:04:44 -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 105062 invoked by uid 89); 25 Jun 2018 21:04:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=rh, rc, Starting, homes X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Jun 2018 21:04:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 058DE560ED; Mon, 25 Jun 2018 17:04:40 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id T6XFheKwXXBG; Mon, 25 Jun 2018 17:04:39 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A0A7C560EC; Mon, 25 Jun 2018 17:04:38 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id D6A9387937; Mon, 25 Jun 2018 14:04:36 -0700 (PDT) Date: Mon, 25 Jun 2018 21:04:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: Tom de Vries , gdb-patches@sourceware.org, Keith Seitz Subject: Re: [pushed] Change inline frame breakpoint skipping logic (fix gdb.gdb/selftest.exp) Message-ID: <20180625210436.GA11382@adacore.com> References: <20180612150620.wloegrt5dgpdugi2@localhost.localdomain> <58a758b7-e4b4-4fee-c7cb-be5a2ab344e6@suse.de> <8c7ace90-f0b8-56f0-0033-5b7827796037@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8c7ace90-f0b8-56f0-0033-5b7827796037@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2018-06/txt/msg00590.txt.bz2 Hello, > gdb/ChangeLog: > 2018-06-19 Pedro Alves > > * inline-frame.c (stopped_by_user_bp_inline_frame): Replace PC > parameter with a block parameter. Compare location's block symbol > with the frame's block instead of addresses. > (skip_inline_frames): Pass the current block instead of the > frame's address. Break out as soon as we determine the frame > should not be skipped. > > gdb/testsuite/ChangeLog: > 2018-06-19 Pedro Alves > > * gdb.opt/inline-break.c (func_inline_callee, func_inline_caller) > (func_extern_caller): New. > (main): Call func_extern_caller. > * gdb.opt/inline-break.exp: Add tests for inline frame skipping > logic change. it looks like this patch is causing a crash with the following example program: $ cat -n r.h 1 /* r.h */ 2 int counter = 42; 3 4 inline void 5 callee () { 6 counter = 0; /* break here */ 7 } $ cat -n r.c 1 /* r.c */ 2 #include "r.h" 3 4 int 5 main () 6 { 7 callee (); 8 } I compiled it using the following commands: $ gcc -c -g -O2 r.c $ gcc -o r r.o Then, trying to put a breakpoint on r.h:6 (inside "callee") causes a SEGV for me: $ gdb -q r Reading symbols from r...done. (gdb) b r.h:6 Breakpoint 1 at 0x4003c0: file r.h, line 6. (gdb) run Starting program: /[...]/r [1] 75618 segmentation fault /[...]/gdb -q r Prior to this commit, the behavior is the following for the "run" command: (gdb) run Starting program: /[...]/r Breakpoint 1, callee () at r.h:6 6 counter = 0; /* break here */ The problem occurs because we apparently assume that a bp_location's symbols is not NULL: Program received signal SIGSEGV, Segmentation fault. 0x00000000006f42bb in stopped_by_user_bp_inline_frame ( stop_chain=, frame_block=) at /homes/brobecke/act/gdb/gdb-head/gdb/inline-frame.c:305 305 && frame_block == SYMBOL_BLOCK_VALUE (loc->symbol)) (gdb) p loc->symbol $1 = (const symbol *) 0x0 I don't know yet whether that's a valid assumption or something occurred earlier in the process. Any thoughts on this before I start looking deeper? I'm using a version of GCC 7.3.1 on x86_64-linux if anyone wants to reproduce. -- Joel