aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 64c624c..530ea29 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -439,13 +439,11 @@ display_gdb_prompt (const char *new_prompt)
static std::string
top_level_prompt (void)
{
- char *prompt;
-
/* Give observers a chance of changing the prompt. E.g., the python
`gdb.prompt_hook' is installed as an observer. */
- gdb::observers::before_prompt.notify (get_prompt ());
+ gdb::observers::before_prompt.notify (get_prompt ().c_str ());
- prompt = get_prompt ();
+ const std::string &prompt = get_prompt ();
if (annotation_level >= 2)
{
@@ -456,7 +454,7 @@ top_level_prompt (void)
beginning. */
const char suffix[] = "\n\032\032prompt\n";
- return std::string (prefix) + prompt + suffix;
+ return std::string (prefix) + prompt.c_str () + suffix;
}
return prompt;
@@ -1253,13 +1251,13 @@ handle_sigtstp (int sig)
static void
async_sigtstp_handler (gdb_client_data arg)
{
- char *prompt = get_prompt ();
+ const std::string &prompt = get_prompt ();
signal (SIGTSTP, SIG_DFL);
unblock_signal (SIGTSTP);
raise (SIGTSTP);
signal (SIGTSTP, handle_sigtstp);
- printf_unfiltered ("%s", prompt);
+ printf_unfiltered ("%s", prompt.c_str ());
gdb_flush (gdb_stdout);
/* Forget about any previous command -- null line now will do