From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 216FD3858D35 for ; Sun, 18 Oct 2020 09:25:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 216FD3858D35 Received: by mail-wm1-x333.google.com with SMTP id d3so9753508wma.4 for ; Sun, 18 Oct 2020 02:25:06 -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=r6aHQckUHm7ASfn5UHeXm+/dP37CW8HSt/Am2f+W7Uo=; b=e/txR+j3Wcr1c0WfDBzHF5J5bw0p2zySke2xKkc0oSGyyoollbRGwSo65gRGqQWyOF gY+OULjnyvl2fQPa1bdV3juAt05X+JBxNJaKRdYmuDs9CoEJ37D5XS5ad22C5FQeVBKk dQNx3CelLy0Ccs+kRJxQsJtgJeAAbsNq4CN5lFAnBAE6SzUG6LH2s+Xw0yDkhR+minIE CTu+YIIxnMwGXeeF9TnaVSciVSpj7hV4lEjavZgZxXIZgFN7Ph4pjLnXObTp6E9f6h36 FRiFGvqbdDJY+BNnOErE6uuVLnf4Oo0mmL3GmDzY/q8GmLkVqEpsv5WRzqAtsh4OQTx2 Pliw== X-Gm-Message-State: AOAM532j2R/Rj76Bc1K0Ljnr5tOgBlpGcYAijSjGiOBwmW6LGoUWG5dj dbHzANhaWpX/6Xw49weNxLIbpqlKyjMXUwbbA8ctUALF6eJTTA== X-Google-Smtp-Source: ABdhPJwKBso6NUHB6ixIv+stKh/uZkLTBRif7RGNExFidTtn9/5Lq4LZfPNn7MAFEuvVGt6QETntF/hSiARRCjo0BRA= X-Received: by 2002:a7b:cb8d:: with SMTP id m13mr11977253wmi.59.1603013105195; Sun, 18 Oct 2020 02:25:05 -0700 (PDT) MIME-Version: 1.0 References: <46a8f2123a154c4b86b8f38fff332f059b72fc77.camel@gnu.org> In-Reply-To: <46a8f2123a154c4b86b8f38fff332f059b72fc77.camel@gnu.org> From: Matt Rice Date: Sun, 18 Oct 2020 09:24:53 +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.8 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 09:25:07 -0000 On Sun, Oct 18, 2020 at 3:27 AM Paul Smith via Gdb wrote: > > Is it possible to change the GDB prompt from within Python, such that > the prompt contains a trailing space (like the default prompt)? > > I cannot figure it out. > > If I run set prompt from the normal command interpreter I can easily > just put a space at the end and it works: > > (gdb) set prompt XXX\n > XXXprint 1 > 1 > > (gdb) set prompt XXX \n > XXX print 1 > 1 > > showing \n to indicate where I type ENTER > > Fine. But this doesn't work from Python: > > (gdb) python > > gdb.execute('set prompt XXX ', True) > > ^D > XXXprint 1 > 1 > > 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