From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11193 invoked by alias); 5 Aug 2003 19:25:59 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 11157 invoked from network); 5 Aug 2003 19:25:53 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 5 Aug 2003 19:25:53 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h75JPrZ00603 for ; Tue, 5 Aug 2003 15:25:53 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h75JPk631776; Tue, 5 Aug 2003 15:25:47 -0400 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h75JPj804548; Tue, 5 Aug 2003 12:25:45 -0700 Message-ID: <3F3004B9.2040003@redhat.com> Date: Tue, 05 Aug 2003 19:25:00 -0000 From: Michael Snyder User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Cagney CC: gdb@sources.redhat.com Subject: Re: set prompt-escape-character References: <3F2F2A72.9020304@redhat.com> In-Reply-To: <3F2F2A72.9020304@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-08/txt/msg00069.txt.bz2 Andrew Cagney wrote: > More -Wformat-nonliteral suprizes. In trying to understand the > "top.c" warnings from: > > /* FIXME: how to protect GDB from crashing > from bad user-supplied format string? */ > sprintf (outp, fmt[0] == 0 ? default_fmt : fmt, > tmp); > > I discovered a new feature: > > (top-gdb) set prompt-escape-char 0x25 > (top-gdb) set prompt PC=0x%0x%$pc > PC=0x1802f68 > > Perhaps it could be change do use the printf code vis: > set prompt "0x%x ", $pc > > Anyway, Michael, was there any doco on this? I can't find anything. No, I think I was hoping no one would use it. ;-) This was something that a customer forced us to add, back in the "bad old days" when there wasn't much review over gdb. I really really tried to talk them out of it, honest. Here's the change log entry: 1999-06-14 Michael Snyder Add parameters to the gdb prompt. * top.c (prompt): Rename to gdb_prompt_string for clarity. (command_line_input): rename "prrompt" to prompt_arg for clarity. (gdb_readline): rename "prrompt" to prompt_arg for clarity. (read_command_lines): rename "prompt" to prompt_arg for clarity. (stop_sig): call get_prompt instead of reading prompt string directly. (command_loop): ditto. (simplified_command_loop): ditto. (gdb_prompt_escape): New variable. Esc char for prompt parameters. (get_prompt_1): New function, workhorse for get_prompt. (get_prompt): Completely rewrite. Add functionality for a parameterized prompt, ie. the displayed prompt can change according to the value of one or more expressions given as parameters in the prompt string. (init_main): use renamed variable gdb_prompt_string. Add new command "set prompt-escape-char" to set gdb_prompt_escape.