public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/31324] New: -var-create: slowdown due to children printing
@ 2024-02-01 12:17 dmitry.neverov at jetbrains dot com
  2024-02-01 12:51 ` [Bug mi/31324] " dmitry.neverov at jetbrains dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dmitry.neverov at jetbrains dot com @ 2024-02-01 12:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31324

            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=11335
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] = {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 = 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-02  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 12:17 [Bug mi/31324] New: -var-create: slowdown due to children printing dmitry.neverov at jetbrains dot com
2024-02-01 12:51 ` [Bug mi/31324] " dmitry.neverov at jetbrains dot com
2024-02-01 16:20 ` tromey at sourceware dot org
2024-02-02  9:07 ` dmitry.neverov at jetbrains 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).