* set prompt-escape-character
@ 2003-08-05 3:54 Andrew Cagney
2003-08-05 19:25 ` Michael Snyder
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2003-08-05 3:54 UTC (permalink / raw)
To: Michael Snyder, gdb
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.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: set prompt-escape-character
2003-08-05 3:54 set prompt-escape-character Andrew Cagney
@ 2003-08-05 19:25 ` Michael Snyder
2003-08-05 19:52 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2003-08-05 19:25 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb
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 <msnyder@cleaver.cygnus.com>
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: set prompt-escape-character
2003-08-05 19:25 ` Michael Snyder
@ 2003-08-05 19:52 ` Andrew Cagney
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2003-08-05 19:52 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb
> 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.
Stan Shebs was always threatening to delete the undocumented commands
;-) Perhaps this should be silently dropped.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-08-05 19:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 3:54 set prompt-escape-character Andrew Cagney
2003-08-05 19:25 ` Michael Snyder
2003-08-05 19:52 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).