public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "gustaf.waldemarson at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/30018] New: Garbage output from not-yet-existing local variables Date: Tue, 17 Jan 2023 19:32:54 +0000 [thread overview] Message-ID: <bug-30018-4717@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2023-01-17 19:32 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-17 19:32 gustaf.waldemarson at gmail dot com [this message] 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
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-30018-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: linkBe 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).