From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by sourceware.org (Postfix) with ESMTPS id 564F73858429 for ; Tue, 21 Dec 2021 14:22:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 564F73858429 Received: by mail-yb1-xb2e.google.com with SMTP id d10so39432448ybn.0 for ; Tue, 21 Dec 2021 06:22:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0z/1hGTl9yXUBRDJAVWssp+pxGDy0iha2VUMgzf27IM=; b=uV1eJsE6QoRskoKdSsSw3tsQMI4OS/Z544oWnP7M+y0qKV+5Drelt9IlHjlIOVmK8U z7z8o9BtRDpAVVEh1xMvv9z8j6WlIc1P86PLUO6EsGS56eacfZ/kz2jzxPoQAxdMUgle UKtz4ERpVDynpCgqDD68qrWOqwXZnMOTS9sR7pWjRT0BfMXgc+aj8VDuaU8kNE1vvaHJ svyrPqfPzm49Ex0vYo147CDOXhOe0W5ThbLT8Hlw5fuYmCFAoGTPO1vabrycnELpBYFN uF8tb9Ju/sayXx99/AoYVI5jZZSnfTKGmLoslirnwNDWb95lqcruGpNgbYM7uap4xSeP Xf4w== X-Gm-Message-State: AOAM530g1XFgBvC5yRm1fQFk4/G7rg2SeNI6ffe3U1mH02ohnNxqIAUM CKyHdXMJfgjlA1WPOwXU8UOYKE/trRkYaBzevwVnIXI6 X-Google-Smtp-Source: ABdhPJx8A7tFGx97SjjfuEEwrjNzZ1z5lpNP8/DBNgzNdPUktB4P4nNzokYiApWGeRDjoJRIxJ37XKyqy7RjVO2G0Cw= X-Received: by 2002:a25:9c86:: with SMTP id y6mr4600527ybo.365.1640096526821; Tue, 21 Dec 2021 06:22:06 -0800 (PST) MIME-Version: 1.0 References: <87h7b2gi2h.fsf@autistici.org> In-Reply-To: <87h7b2gi2h.fsf@autistici.org> From: David Blaikie Date: Tue, 21 Dec 2021 09:21:56 -0500 Message-ID: Subject: Re: gdb displaying only one line of instructions when stepping To: Andrea Monaco Cc: gdb X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Dec 2021 14:22:10 -0000 The actual underlying DWARF information that gdb is using to render source only describes a single line of source - and gdb probably doesn't try to parse or interpret the source code at all. I'm not sure about GCC's generated DWARF, but Clang's generated DWARF will use its AST's "preferred location" as the location of a given instruction. This is the same location as would be highlighted with a "^" in a Clang warning or other diagnostic. eg: a = x + y; The store to 'a' should be attributed to '=' and the add instruction should be attributed to '+'. If GCC rendered the column info from the line table, it might make it more clear? (maybe there's an option to make it do that) Though ultimately the DWARF format itself would probably need to be improved to describe source ranges (maybe even non-contiguous ones) and a preferred location - then then + operation could be described as the whole range of "x + y" with a specific location of '+', and the assignment could be the whole range of "a = x + y" with a specific location of '='. On Tue, Dec 21, 2021 at 9:16 AM Andrea Monaco via Gdb wrote: > > Hello. > > > I noticed that, when single stepping through a program, gdb shows only > one line of instructions that take more than one. > > For example, a simple > > a = > 5; > > > is showed as > > (gdb) next > 24 a = > (gdb) > > As a user, I'd definitely prefer gdb to show me the full instruction I'm > about to run. > > > Maybe there's some way to do that, and I missed it? Otherwise I can > work on it. > > > > Let me know, > > Andrea Monaco >