From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bzmkNOb0v2RQtS4AWB0awg (envelope-from ) for ; Tue, 25 Jul 2023 12:14:30 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=WEQ1Xaw8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CD8C41E0C0; Tue, 25 Jul 2023 12:14:30 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B3BFC1E00F for ; Tue, 25 Jul 2023 12:14:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B0C29385AF98 for ; Tue, 25 Jul 2023 16:14:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0C29385AF98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690301667; bh=qG8AsTsbdNRqbT0afZunxsZs7XuEE5Kh/xv3VvawM48=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WEQ1Xaw84Fs1la4kyWuCRAHAoGGf6+pTB2c1pGSJ+ckVbZw+p/HfIcvf4v2KgAEau iG7Ot4OwlY1FyAV+4t1N8iuiO5psUdCGO8FqP2eEnx0ZVTBrMGoYyJmOOdyIq/L7Yj lm/GET8EvWeL/UTfxJfS/L29UnL/lWo90CtyhHzs= Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 85C003858280 for ; Tue, 25 Jul 2023 16:13:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85C003858280 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-522462d8416so1476534a12.1 for ; Tue, 25 Jul 2023 09:13:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690301638; x=1690906438; h=content-transfer-encoding:subject:from:content-language:to :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=qG8AsTsbdNRqbT0afZunxsZs7XuEE5Kh/xv3VvawM48=; b=aia44aCovODpfM4H96ewBo9Fp4wjs8cYySTf1MNQXGTQg18tGtbVoGn2lyAxUCBgnL pnosP6iVyqP+YIeUgD0xDbYMcR+bRgpGqWIy8FgNVSCJ1MJlkmqSOlbN/TsaR+4h1IQa GZKlrme0VGLBSmrPoldOEfHMKb4PH4hOVIIXnw2m1mQjDQT4kAbM8hxQCiRT3EluuxVl OOrv7lethaURbNFdvT+ve7zXYovtkYdYzXe5wVDZ+0XF/JcWNizBy3NH4ZNgBnDrMzWF UVHSbIug8XcSoUv/aiiUNOjHzVAAYg4fBv71nF8HOxxgmomiz5D78TBbIuk7fQanqWWZ SPAw== X-Gm-Message-State: ABy/qLZ0nH/ywF8dHR0SnPSLFkFJr7m532f4PgA7WwZZ3sGZkw66WElU EHtKRqjs6TxBC5rKHtYIocYPVIXgJzo= X-Google-Smtp-Source: APBJJlHrirQG/Q+TMbyvN+AF+i2I+iN1lKNxFM+IFmxquq6Adnd++l3QHNMrYy+Oqy2NLPr2oZtgCw== X-Received: by 2002:a17:906:3f0c:b0:99b:6e54:bd5b with SMTP id c12-20020a1709063f0c00b0099b6e54bd5bmr11487513ejj.50.1690301637861; Tue, 25 Jul 2023 09:13:57 -0700 (PDT) Received: from [192.168.0.110] ([91.187.59.126]) by smtp.gmail.com with ESMTPSA id u20-20020a170906c41400b00993928e4d1bsm8283870ejz.24.2023.07.25.09.13.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Jul 2023 09:13:57 -0700 (PDT) Message-ID: <9fc91cc3-adbe-d2f8-8b27-4245071d6c72@gmail.com> Date: Tue, 25 Jul 2023 18:13:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 To: gdb@sourceware.org Content-Language: en-US Subject: How can I reload a pretty printer? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: meator via Gdb Reply-To: meator Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" Hi. When writing a pretty printer, I want to repeatedly test it. This is pretty complicated because GDB has no builtin mechanisms to do such thing (that I know of) and breakpoint() pretty much can not be used because GDB's Python doesn't have access to the capable pty so interactive use of PDB is impossible. Even the classic "printf style" debugging doesn't work because Python's print() doesn't work (gdb.write() has to be used instead). I need to test the pretty printer often because the official Python interface documentation is quite lacking and the interface itself is imperfect^1. Accessing the docstrings of the Python interface is difficult because the gdb module nor other modules can be imported in standalone Python (I've tried to add it to $PYTHONPATH but with no success; How are you supposed to access the docstrings?). Therefore my last solution is to load the pretty printer, try it in gdb, modify the pretty printer and repeat. But a pretty printer can be sourced only once because the second source call will fail due to the fact that the pretty printer is already registered. I have to restart GDB every time I modify the pretty printer which is extremely impractical. Is there a way to live reload the pretty printer? 1: There is no sane way to call member functions through gdb.Value which is kind of important in C++: https://stackoverflow.com/q/22774067/13840624