public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30018] New: Garbage output from not-yet-existing local variables
@ 2023-01-17 19:32 gustaf.waldemarson at gmail dot com
2023-01-17 19:39 ` [Bug gdb/30018] " pinskia at gcc dot gnu.org
2023-01-18 9:29 ` jwakely.gcc at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: gustaf.waldemarson at gmail dot com @ 2023-01-17 19:32 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30018
Bug ID: 30018
Summary: Garbage output from not-yet-existing local variables
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: gustaf.waldemarson at gmail dot com
Target Milestone: ---
Hello,
This was originally reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107965
As a bug on the libstdc++ pretty printer, but given the comments, it seems a
bit unclear to me whether this is a GDB bug, if it is a bug in the pretty
printer framework, or both, hence this ticket.
In brief, doing the following yields creates large amount of garbage output:
Given the following simple `gdbinit` that only initializes the pretty printers
and enables Python stack-traces:
python
import os
import re
import sys
import os.path
import textwrap
import gdb
import gdb.types
import gdb.printing
home = os.environ.get("HOME", "~")
default_path = os.path.join(home, "git", "installs")
objects_dir = os.environ.get("objects_dir", default_path)
python_addons = os.path.join(objects_dir, "gcc", "libstdc++-v3", "python")
if os.path.isdir(python_addons):
print("Installing libstdcxx printers...")
sys.path.insert(0, python_addons)
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers(None)
end
set python print-stack full
and this simple C++ file:
#include <vector>
#include <string>
#include <iostream>
using namespace std;
int main(void)
{
vector<string> test{"test", "test2"};
string blabla = "hello";
int b = 2;
std::cout << blabla << " "
<< b << " "
<< test[0] << " " << test[1] << std::endl;
return 0;
}
Compile it and start debugging:
g++ -g3 test.cpp
gdb -q a.out
(gdb) start
(gdb) info locals
At `info locals`, the garbage output is create, along with a large number of
Python exceptions from the pretty printers. Following the Python
print-stack-trace reveals a possible error here:
File
"/home/xaldew/git/installs/gcc/libstdc++-v3/python/libstdcxx/v6/printers.py",
line 971, in to_string
return ptr.lazy_string (length = length)
OverflowError: int too big to convert
After which it disappears into various parts of the framework(s).
A number of comments from the original thread mentions that at the time of
`info
locals`, none of the local variables should exist yet somehow they do and thus
causes these problems.
Frankly, I don't know enough about these low level details, but the comments
from the other thread were compelling enough that it probably should be
discussed here.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug gdb/30018] Garbage output from not-yet-existing local variables
2023-01-17 19:32 [Bug gdb/30018] New: Garbage output from not-yet-existing local variables gustaf.waldemarson at gmail dot com
@ 2023-01-17 19:39 ` pinskia at gcc dot gnu.org
2023-01-18 9:29 ` jwakely.gcc at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-17 19:39 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30018
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=107965
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug gdb/30018] Garbage output from not-yet-existing local variables
2023-01-17 19:32 [Bug gdb/30018] New: Garbage output from not-yet-existing local variables gustaf.waldemarson at gmail dot com
2023-01-17 19:39 ` [Bug gdb/30018] " pinskia at gcc dot gnu.org
@ 2023-01-18 9:29 ` jwakely.gcc at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: jwakely.gcc at gmail dot com @ 2023-01-18 9:29 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30018
Jonathan Wakely <jwakely.gcc at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jwakely.gcc at gmail dot com
--- Comment #1 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
As pointed out in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107965#c3 the
debuginfo from GCC incorrectly says that the objects are alive from the start
of the block, so GDB is doing what it thinks is right.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-18 9:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 19:32 [Bug gdb/30018] New: Garbage output from not-yet-existing local variables gustaf.waldemarson at gmail dot com
2023-01-17 19:39 ` [Bug gdb/30018] " pinskia at gcc dot gnu.org
2023-01-18 9:29 ` jwakely.gcc at gmail dot com
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).