public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31463] New: Artificial variables in locals output
@ 2024-03-08  9:54 dmitry.neverov at jetbrains dot com
  2024-03-08  9:55 ` [Bug gdb/31463] " sam at gentoo dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dmitry.neverov at jetbrains dot com @ 2024-03-08  9:54 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-08 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08  9:54 [Bug gdb/31463] New: Artificial variables in locals output dmitry.neverov at jetbrains dot com
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

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).