From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1524B3858D28; Tue, 17 Jan 2023 19:32:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1524B3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673983975; bh=Ht2x+WuqhuxCCUYdWgD7EFSg/PqS22b3SUsUtm/jSKc=; h=From:To:Subject:Date:From; b=CvMTijNefVriXYGoIORRsVUDgAkyQ0tT/r6U0X1cNhC9FGyLg4jkll4wfszDCfSEF MM7joCHobvx/ak6PxH6zZzPbr9YwVojTiW8632o/aRmN0WT8sDeqM69SPZN30FUu3+ gpEpolMu/atuGv5GgbeiKKjutcHqUYilfXAyEp/U= From: "gustaf.waldemarson at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gustaf.waldemarson at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30018 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=3D107965 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 print= ers 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 =3D os.environ.get("HOME", "~") default_path =3D os.path.join(home, "git", "installs") objects_dir =3D os.environ.get("objects_dir", default_path) python_addons =3D os.path.join(objects_dir, "gcc", "libstdc++-v3", "pyt= hon") 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 #include #include using namespace std; int main(void) { vector test{"test", "test2"}; string blabla =3D "hello"; int b =3D 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 =3D 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 t= hus 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. --=20 You are receiving this mail because: You are on the CC list for the bug.=