From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 8EDFD3858024 for ; Sun, 18 Oct 2020 14:45:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8EDFD3858024 Received: by mail-wm1-x329.google.com with SMTP id f21so7838368wml.3 for ; Sun, 18 Oct 2020 07:45:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cRWbCSUaAnw/y2CpnJsS5k0KTOunLXtgeDpY30qz91E=; b=TXSBI5Y6+nk4/mQBDUQQh6xDWDSjv5cOUOvOhBe1wocjhCqwEqOcpiEqeskRcMiRY0 HbdrRFkHmsk5X7CfOoeQpuATrUVP8wRCKdt1OhRs6QUZvbmnx2asRcfFD0BHJ7cAoKiU QspBraUTsWYozq9GuEx51U4WyYj7yWLSHpPsLy+nNbj2T3M4YSdCtrA80UePyLT2VlqY Z8kmpH8f3xCOdnVcpchnms6DOZy2GM9wnt60Vx5kTaTyaisTjSsDwrU1fcOuD8WVlKCB FNBx3o6DJbwUQLT+MvOFP7qW726pLY9A0guUzgJtoV+CBrSugLWO4pUp9uYVNbeS8Xln KjJQ== X-Gm-Message-State: AOAM532JLkcVi0JiPdi7mTWVWP5UQjvZMkRAxIQkIUmmzZiXoXJakWLs EBLuNNLBaguct4wl84titQ7fV5mZGMHPYYvX9odn2fEuV/c= X-Google-Smtp-Source: ABdhPJw9Uq+HcsxK3z3hMK6D9zdLQPpI1sCvRNbzoU0OBE9tM7DkfIsHPKQPZrec1h+F3dc7Q2R6XS9T2D2xe4nuV/8= X-Received: by 2002:a7b:c055:: with SMTP id u21mr13236996wmc.27.1603032342428; Sun, 18 Oct 2020 07:45:42 -0700 (PDT) MIME-Version: 1.0 References: <46a8f2123a154c4b86b8f38fff332f059b72fc77.camel@gnu.org> In-Reply-To: From: Matt Rice Date: Sun, 18 Oct 2020 14:45:31 +0000 Message-ID: Subject: Re: GDB: Setting the prompt from python To: Paul Smith Cc: GDB Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.2 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 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Sun, 18 Oct 2020 14:45:46 -0000 On Sun, Oct 18, 2020 at 2:08 PM Paul Smith wrote: > > On Sun, 2020-10-18 at 09:24 +0000, Matt Rice wrote: > > > It seems that no matter what I do, the trailing space is stripped > > > off. Is there some other way to set the prompt from Python? > > > > Weird, using the python prompt hook does work. > > > > (gdb) python > > > gdb.prompt_hook = lambda old_prompt: "XXX " > > > end > > XXX quit > > Aha! Thanks. > > Well, it kind of makes sense to me but is unfortunate. The problem is > probably that GDB is stripping the command that is passed to it via > gdb.execute() before running it so the whitespace goes away before GDB > tries to run the command. > > In the prompt_hook version the static string containing the space is > returned and so is preserved. > I forgot to mention, I believe when doing this via the prompt hook, neither set prompt, or set extended-prompt are going to work again unless the user also sets the prompt hook to None, which may or may not be an issue for you, but something to be aware of.