public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dmitry.neverov at jetbrains dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31463] New: Artificial variables in locals output
Date: Fri, 08 Mar 2024 09:54:14 +0000	[thread overview]
Message-ID: <bug-31463-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=31463

            Bug ID: 31463
           Summary: Artificial variables in locals output
           Product: gdb
           Version: 14.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: dmitry.neverov at jetbrains dot com
  Target Milestone: ---

To reproduce compile the program (g++ -g -o main main.cpp):

#include <iostream>
#include <vector>

int main() {
  std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  for (auto i : v) {
    std::cout << i << std::endl;
  }
  return 0;
}

Run gdb: 

$ gdb -q -batch main -ex "b main.cpp:7" -ex "run" -ex "info locals"

The output contains artificial symbols __for_range, __for_begin, __for_end:

Breakpoint 1, main () at main.cpp:7
7           std::cout << i << std::endl;
i = 1
__for_range = std::vector of length 10, capacity 10 = {1, 2, 3, 4, 5, 6, 7, 8,
9, 10}
__for_begin = 1
__for_end = 60721
v = std::vector of length 10, capacity 10 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

These symbols also returned when iterating over a block
in python, and is_artificial is not exposed in python API.

This was fixed for Ada, but not other languages in
https://sourceware.org/bugzilla/show_bug.cgi?id=28180.

I've noticed, that in python such symbols have the line=0.
Is it correct to use this as a sign that the symbol is artificial?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2024-03-08  9:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  9:54 dmitry.neverov at jetbrains dot com [this message]
2024-03-08  9:55 ` [Bug gdb/31463] " sam at gentoo dot org
2024-03-08 11:44 ` ssbssa at sourceware dot org
2024-03-08 13:38 ` dmitry.neverov at jetbrains dot com
2024-03-08 16:14 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31463-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).