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
` (5 more replies)
0 siblings, 6 replies; 7+ 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] 7+ messages in thread
* [Bug gdb/31463] Artificial variables in locals output
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 ` sam at gentoo dot org
2024-03-08 11:44 ` ssbssa at sourceware dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2024-03-08 9:55 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31463
Sam James <sam at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://sourceware.org/bugz
| |illa/show_bug.cgi?id=28180
CC| |sam at gentoo dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug gdb/31463] Artificial variables in locals output
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
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ssbssa at sourceware dot org @ 2024-03-08 11:44 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31463
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug gdb/31463] Artificial variables in locals output
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
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dmitry.neverov at jetbrains dot com @ 2024-03-08 13:38 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31463
--- Comment #1 from Dmitry Neverov <dmitry.neverov at jetbrains dot com> ---
I guess I take it back: `this` in c++ methods is also artificial and has
line=0,
but should be shown.
I don't know if range-loop variables are shown by design or not.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug gdb/31463] Artificial variables in locals output
2024-03-08 9:54 [Bug gdb/31463] New: Artificial variables in locals output dmitry.neverov at jetbrains dot com
` (2 preceding siblings ...)
2024-03-08 13:38 ` dmitry.neverov at jetbrains dot com
@ 2024-03-08 16:14 ` tromey at sourceware dot org
2025-01-02 18:59 ` ssbssa at sourceware dot org
2025-01-02 20:41 ` tromey at sourceware dot org
5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2024-03-08 16:14 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31463
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Dmitry Neverov from comment #1)
> I don't know if range-loop variables are shown by design or not.
Normally gdb just does what the compiler tells it.
Ada is a bit special because it emits some forms of debuginfo
via symbol names. By default there isn't much of this any
more, but there are still a few cases that can't be avoided.
It would be fine by me to give Python a way to detect artificiality.
Omitting artificial variables via some option would also be fine.
I suppose my view is that, overall, seeing these isn't too confusing,
and might be helpful in some cases when debugging. It lets you
inspect a compiler transform and see some objects that would otherwise
be inaccessible -- like if you want to debug some iterator implementation.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug gdb/31463] Artificial variables in locals output
2024-03-08 9:54 [Bug gdb/31463] New: Artificial variables in locals output dmitry.neverov at jetbrains dot com
` (3 preceding siblings ...)
2024-03-08 16:14 ` tromey at sourceware dot org
@ 2025-01-02 18:59 ` ssbssa at sourceware dot org
2025-01-02 20:41 ` tromey at sourceware dot org
5 siblings, 0 replies; 7+ messages in thread
From: ssbssa at sourceware dot org @ 2025-01-02 18:59 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31463
--- Comment #3 from Hannes Domani <ssbssa at sourceware dot org> ---
The gdb.Symbol.is_artificial for python was added in this commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9ba5ef4bf1e3266db47eb500beab803d03c74b3f
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug gdb/31463] Artificial variables in locals output
2024-03-08 9:54 [Bug gdb/31463] New: Artificial variables in locals output dmitry.neverov at jetbrains dot com
` (4 preceding siblings ...)
2025-01-02 18:59 ` ssbssa at sourceware dot org
@ 2025-01-02 20:41 ` tromey at sourceware dot org
5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2025-01-02 20:41 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31463
--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom Tromey from comment #2)
> I suppose my view is that, overall, seeing these isn't too confusing,
> and might be helpful in some cases when debugging. It lets you
> inspect a compiler transform and see some objects that would otherwise
> be inaccessible -- like if you want to debug some iterator implementation.
FWIW I ended up doing just this the other day.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-01-02 20:41 UTC | newest]
Thread overview: 7+ 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
2025-01-02 18:59 ` ssbssa at sourceware dot org
2025-01-02 20:41 ` 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).