From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-522462d8416so1476534a12.1 for ; Tue, 25 Jul 2023 09:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690301638; x=1690906438; h=content-transfer-encoding:subject:from:content-language:to :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=qG8AsTsbdNRqbT0afZunxsZs7XuEE5Kh/xv3VvawM48=; b=iC+OCX6sH3J2We7c4RG1qXJAf9ci6kO49bJ6z2je5D4ab28IyZi16ECrEfJp4tjXke OoBF9V7bL/esbh7Dg+vbOm4iakfupoWR+++ITaU/qnZZJAvoGl5FIYaaR2TmnW+/RZCR DW7Gzu5LbY5lRCiPsV+8Lm2bk51OO4Z3mmZi4G1ueip5drBZuLzas+RgGMzh1efW0yx+ 0T9Iu0kV+xV6Rzq10De67Sr4SK24gY6Vdj8xNtwAnlOJm2yeSBy6wCmeg1tVLMInVdhE esUMmyywemHpQvhyPiUCMnpK9C9PeM8igrDh0Do1wvKtODughgcF+Jrt5Jhfe6sqqftG UcAw== 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 From: meator 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 List-Id: 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