From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CCF663858C3A; Thu, 1 Feb 2024 12:17:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCF663858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706789878; bh=7Qekn2wKmT+t6IpsmpUVihwlkkleWyp8mZogML2J2Rc=; h=From:To:Subject:Date:From; b=fuuVaW0f9FqM0wdCx43w8523vPEBGzEkNEbdqS98gNc7aeLf43PsaBAiHvSZb0xZl jLSbtOuF0boKtncHfzbrhk8Kh78tZ3ecbEWNT258MZr0gAP2qk+JiYN6dUCTN78clm FanTOkI+DipY8O3LRTjcelGzze18u+sYPhegMjRY= From: "dmitry.neverov at jetbrains dot com" To: gdb-prs@sourceware.org Subject: [Bug mi/31324] New: -var-create: slowdown due to children printing Date: Thu, 01 Feb 2024 12:17:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: mi X-Bugzilla-Version: 14.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmitry.neverov at jetbrains 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=3D31324 Bug ID: 31324 Summary: -var-create: slowdown due to children printing Product: gdb Version: 14.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: mi Assignee: unassigned at sourceware dot org Reporter: dmitry.neverov at jetbrains dot com Target Milestone: --- Fix for https://sourceware.org/bugzilla/show_bug.cgi?id=3D11335 changed the logic of -var-create. Before, if a var had children, -var-create returned "{...}" as a value. Now, it appends the pretty printer's to_string result to the printed children. It looks like there is no way to disable this behavior. New logic has performance implications. For example, running -var-create v1 * "ss" in the following program: typedef struct { int x, y; } SlowStruct; int main() { SlowStruct ss[100] =3D {0}; return 0; //break } will be slow if SlowStruct has a slow pretty-printer: import gdb import gdb.printing import time class SlowStructPrinter: def __init__(self, val): self.val =3D val def to_string(self): time.sleep(1) return ("slow struct") def slowStructPrinterMatcher(val): if "SlowStruct" in str(val.type): return SlowStructPrinter(val) gdb.pretty_printers.append(slowStructPrinterMatcher) This was fast in 13.2, because children were not printed. --=20 You are receiving this mail because: You are on the CC list for the bug.=