From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68849 invoked by alias); 23 Aug 2019 21:54:54 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 68841 invoked by uid 89); 23 Aug 2019 21:54:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*i:sk:CAF8i9m, jankratochvilredhatcom, jan.kratochvil@redhat.com, HX-Received:sk:i14mr76 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Aug 2019 21:54:53 +0000 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C4A583F3C for ; Fri, 23 Aug 2019 21:54:52 +0000 (UTC) Received: by mail-wm1-f72.google.com with SMTP id 19so4784084wmk.0 for ; Fri, 23 Aug 2019 14:54:51 -0700 (PDT) Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id 91sm12215044wrp.3.2019.08.23.14.54.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Aug 2019 14:54:49 -0700 (PDT) Subject: Re: gdb command "next" wrongly working as command "step" To: William Tambe , Jan Kratochvil References: <20190818041556.GA11323@host1.jankratochvil.net> <20190818090556.GA19968@host1.jankratochvil.net> Cc: gdb@sourceware.org From: Pedro Alves Message-ID: Date: Fri, 23 Aug 2019 21:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-08/txt/msg00032.txt.bz2 On 8/23/19 10:33 PM, William Tambe wrote: > On Sun, Aug 18, 2019 at 4:06 AM Jan Kratochvil > wrote: >> On Sun, 18 Aug 2019 10:31:54 +0200, William Tambe wrote: >>> Can I have suggestions of locations within the gdb code where I could >>> put breakpoints to trace where the issue I am having is occurring ? >> Check what "set debug infrun 1" says and grep the sources for the displayed >> messages. >> > Using "set debug infrun 1", I can see that GDB stops only after > printing the following message: > infrun: stepped to a different line. > When the above event happens, GDB has stepped inside the function, > which is obviously going to be on a different line; however, I am > expecting GDB to step over the function. Do a backtrace at this point. GDB should see the caller in frame #1. Sounds like it doesn't. Or to be more accurate, use "stepi" to step to the first instruction of the called function, and run "bt" there. As Jan said, for "next" to work properly, backtrace/unwinding must work properly. When "next" behaves like "step", the most frequent reason is that unwinding is broken. "next" does a "backtrace" to detect whether you've stepped into called function, and if you did, then it continues execution to the address where the called function returns. Thanks, Pedro Alves