Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: gdb/tui/tui-hooks.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/tui/tui-data.c ('k') | gdb/tui/tui-main.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* GDB hooks for TUI. 1 /* GDB hooks for TUI.
2 2
3 Copyright (C) 2001-2012 Free Software Foundation, Inc. 3 Copyright (C) 2001-2012 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (tui_active) 62 if (tui_active)
63 tui_display_main (); 63 tui_display_main ();
64 } 64 }
65 65
66 static int ATTRIBUTE_PRINTF (1, 0) 66 static int ATTRIBUTE_PRINTF (1, 0)
67 tui_query_hook (const char *msg, va_list argp) 67 tui_query_hook (const char *msg, va_list argp)
68 { 68 {
69 int retval; 69 int retval;
70 int ans2; 70 int ans2;
71 int answer; 71 int answer;
72 char *question;
73 struct cleanup *old_chain;
74
75 /* Format the question outside of the loop, to avoid reusing
76 ARGP. */
77 question = xstrvprintf (msg, argp);
78 old_chain = make_cleanup (xfree, question);
72 79
73 echo (); 80 echo ();
74 while (1) 81 while (1)
75 { 82 {
76 wrap_here (""); /* Flush any buffered output. */ 83 wrap_here (""); /* Flush any buffered output. */
77 gdb_flush (gdb_stdout); 84 gdb_flush (gdb_stdout);
78 85
79 vfprintf_filtered (gdb_stdout, msg, argp); 86 fputs_filtered (question, gdb_stdout);
80 printf_filtered (_("(y or n) ")); 87 printf_filtered (_("(y or n) "));
81 88
82 wrap_here (""); 89 wrap_here ("");
83 gdb_flush (gdb_stdout); 90 gdb_flush (gdb_stdout);
84 91
85 answer = tui_getc (stdin); 92 answer = tui_getc (stdin);
86 clearerr (stdin); /* in case of C-d */ 93 clearerr (stdin); /* in case of C-d */
87 if (answer == EOF) /* C-d */ 94 if (answer == EOF) /* C-d */
88 { 95 {
89 retval = 1; 96 retval = 1;
(...skipping 16 matching lines...) Expand all
106 break; 113 break;
107 } 114 }
108 if (answer == 'N') 115 if (answer == 'N')
109 { 116 {
110 retval = 0; 117 retval = 0;
111 break; 118 break;
112 } 119 }
113 printf_filtered (_("Please answer y or n.\n")); 120 printf_filtered (_("Please answer y or n.\n"));
114 } 121 }
115 noecho (); 122 noecho ();
123
124 do_cleanups (old_chain);
116 return retval; 125 return retval;
117 } 126 }
118 127
119 /* Prevent recursion of deprecated_register_changed_hook(). */ 128 /* Prevent recursion of deprecated_register_changed_hook(). */
120 static int tui_refreshing_registers = 0; 129 static int tui_refreshing_registers = 0;
121 130
122 static void 131 static void
123 tui_register_changed_hook (int regno) 132 tui_register_changed_hook (int regno)
124 { 133 {
125 struct frame_info *fi; 134 struct frame_info *fi;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 304 }
296 305
297 void _initialize_tui_hooks (void); 306 void _initialize_tui_hooks (void);
298 307
299 void 308 void
300 _initialize_tui_hooks (void) 309 _initialize_tui_hooks (void)
301 { 310 {
302 /* Install the permanent hooks. */ 311 /* Install the permanent hooks. */
303 observer_attach_new_objfile (tui_new_objfile_hook); 312 observer_attach_new_objfile (tui_new_objfile_hook);
304 } 313 }
OLDNEW
« no previous file with comments | « gdb/tui/tui-data.c ('k') | gdb/tui/tui-main.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698