From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129949 invoked by alias); 1 Jul 2016 11:02:50 -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 129934 invoked by uid 89); 1 Jul 2016 11:02:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=reordered, sk:should_, ped X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Jul 2016 11:02:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 09AC22F; Fri, 1 Jul 2016 04:03:41 -0700 (PDT) Received: from e108577-lin.localnet (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3A2DB3F445; Fri, 1 Jul 2016 04:02:46 -0700 (PDT) From: Thomas Preudhomme To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3 24/34] Push thread->control.command_interp to the struct thread_fsm Date: Fri, 01 Jul 2016 11:02:00 -0000 Message-ID: <8587009.ikB25uYBLk@e108577-lin> User-Agent: KMail/4.13.3 (Linux/3.13.0-85-generic; KDE/4.13.3; x86_64; ; ) In-Reply-To: <1462538104-19109-25-git-send-email-palves@redhat.com> References: <1462538104-19109-25-git-send-email-palves@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00003.txt.bz2 Hi Pedro, On Friday 06 May 2016 13:34:54 Pedro Alves wrote: > I noticed that if we step into an inline function, step_1 never > reaches proceed, and thus nevers sets the thread's > tp->control.command_interp. Because of that, > should_print_stop_to_console fails to determine that is should print > stop output to the console. > > The fix is to set the thread's command_interp earlier. However, I > realized that we can move that field to the thread_fsm, given that its > lifetime is exactly the same as thread_fsm. So the patch plumbs all > fsms constructors to take the command interp and store it in the > thread_fsm. > > We can see the fix in action, with e.g., the gdb.opt/inline-cmds.exp > test, and issuing a step when stopped at line 67: > > &"s\n" > ^running > *running,thread-id="all" > (gdb) > ~"67\t result = func2 ();\n" > *stopped,reason="end-stepping- > range",frame={addr="0x00000000004004d0",func="main",args=[],file="/home/pedr > o/gdb/mygit/src/gdb/testsuite/gdb.opt/inline- > cmds.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline- > cmds.c",line="67"},thread-id="1",stopped-threads="all",core="0" > (gdb) > s > &"s\n" > ^running > *running,thread-id="all" > (gdb) > + ~"func2 () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline- > cmds.c:67\n" > + ~"67\t result = func2 ();\n" > *stopped,reason="end-stepping- > range",frame={addr="0x00000000004004d0",func="func2",args=[],file="/home/ped > ro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline- > cmds.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.opt/inline- > cmds.c",line="67"},thread-id="1",stopped-threads="all",core="0" > (gdb) > > (The inline-cmds.exp command is adjusted to exercise this.) > > (Due to the follow_fork change, this also fixes "next N" across a fork > with "set follow-fork child" with "set detach-on-fork on". Commands > that rely on internal breakpoints, like "finish" will still require > more work to migrate breakpoints etc. to the child thread.) The new tests added by this patch fail for arm-none-eabi targets because -O2 leads to instructions to be reordered widely. In this case, the instruction that follows the first one for line 64 is related to line 70 so the test is failing. Shouldn't this test be compiled with -Og and probably also -finline- small-functions -findirect-inlining -fpartial-inlining which relates to inlining and are included in -O2. Best regards, Thomas