diff --git a/gdb/defs.h b/gdb/defs.h
index 6b63b6a..24e1e3b 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -259,11 +259,11 @@ extern void print_transfer_performance (struct ui_file *stream,
 
 typedef void initialize_file_ftype (void);
 
-extern char *gdb_readline (char *);
+extern char *gdb_readline (const char *);
 
-extern char *gdb_readline_wrapper (char *);
+extern char *gdb_readline_wrapper (const char *);
 
-extern char *command_line_input (char *, int, char *);
+extern char *command_line_input (const char *, int, char *);
 
 extern void print_prompt (void);
 
@@ -636,7 +636,7 @@ extern void (*deprecated_warning_hook) (const char *, va_list)
 extern void (*deprecated_interactive_hook) (void);
 extern void (*deprecated_readline_begin_hook) (char *, ...)
      ATTRIBUTE_FPTR_PRINTF_1;
-extern char *(*deprecated_readline_hook) (char *);
+extern char *(*deprecated_readline_hook) (const char *);
 extern void (*deprecated_readline_end_hook) (void);
 extern void (*deprecated_register_changed_hook) (int regno);
 extern void (*deprecated_context_hook) (int);
diff --git a/gdb/event-top.c b/gdb/event-top.c
index cb438ac..55caf72 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -288,7 +288,7 @@ gdb_rl_callback_handler_reinstall (void)
    3. On prompting for pagination.  */
 
 void
-display_gdb_prompt (char *new_prompt)
+display_gdb_prompt (const char *new_prompt)
 {
   char *actual_gdb_prompt = NULL;
   struct cleanup *old_chain;
diff --git a/gdb/event-top.h b/gdb/event-top.h
index 919287e..0c8baae 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -27,7 +27,7 @@ struct cmd_list_element;
 /* Exported functions from event-top.c.
    FIXME: these should really go into top.h.  */
 
-extern void display_gdb_prompt (char *new_prompt);
+extern void display_gdb_prompt (const char *new_prompt);
 void gdb_setup_readline (void);
 void gdb_disable_readline (void);
 extern void async_init_signals (void);
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index d98a196..7aa5436 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -26,10 +26,13 @@
    cases, sys_stdin and sys_stdout are always stdin and stdout
    respectively, as far as I can tell; they are ignored and
    command_line_input is used instead.  */
-
 static char *
 gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 4
+			const char *prompt)
+#else
 			char *prompt)
+#endif
 {
   int n;
   char *p = NULL, *q;
diff --git a/gdb/top.c b/gdb/top.c
index 83d858a..ce29553 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -215,7 +215,7 @@ void (*deprecated_warning_hook) (const char *, va_list);
    window and it can close it.  */
 
 void (*deprecated_readline_begin_hook) (char *, ...);
-char *(*deprecated_readline_hook) (char *);
+char *(*deprecated_readline_hook) (const char *);
 void (*deprecated_readline_end_hook) (void);
 
 /* Called as appropriate to notify the interface that we have attached
@@ -620,7 +620,7 @@ prevent_dont_repeat (void)
 
    A NULL return means end of file.  */
 char *
-gdb_readline (char *prompt_arg)
+gdb_readline (const char *prompt_arg)
 {
   int c;
   char *result;
@@ -812,7 +812,7 @@ gdb_readline_wrapper_cleanup (void *arg)
 }
 
 char *
-gdb_readline_wrapper (char *prompt)
+gdb_readline_wrapper (const char *prompt)
 {
   struct cleanup *back_to;
   struct gdb_readline_wrapper_cleanup *cleanup;
@@ -912,14 +912,14 @@ gdb_rl_operate_and_get_next (int count, int key)
    simple input as the user has requested.  */
 
 char *
-command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
+command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
 {
   static char *linebuffer = 0;
   static unsigned linelength = 0;
   char *p;
   char *p1;
   char *rl;
-  char *local_prompt = prompt_arg;
+  char *local_prompt;
   char *nline;
   char got_eof = 0;
 
@@ -938,6 +938,8 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
       strcat (local_prompt, "\n\032\032");
       strcat (local_prompt, annotation_suffix);
       strcat (local_prompt, "\n");
+
+      prompt_arg = local_prompt;
     }
 
   if (linebuffer == 0)
@@ -979,15 +981,15 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
       /* Don't use fancy stuff if not talking to stdin.  */
       if (deprecated_readline_hook && input_from_terminal_p ())
 	{
-	  rl = (*deprecated_readline_hook) (local_prompt);
+	  rl = (*deprecated_readline_hook) (prompt_arg);
 	}
       else if (command_editing_p && input_from_terminal_p ())
 	{
-	  rl = gdb_readline_wrapper (local_prompt);
+	  rl = gdb_readline_wrapper (prompt_arg);
 	}
       else
 	{
-	  rl = gdb_readline (local_prompt);
+	  rl = gdb_readline (prompt_arg);
 	}
 
       if (annotation_level > 1 && instream == stdin)
@@ -1021,7 +1023,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
 	break;
 
       p--;			/* Put on top of '\'.  */
-      local_prompt = (char *) 0;
+      prompt_arg = NULL;
     }
 
 #ifdef STOP_SIGNAL
