| OLD | NEW |
| 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-2013 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. |
| 11 | 11 |
| 12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 { | 157 { |
| 158 tui_update_all_breakpoint_info (); | 158 tui_update_all_breakpoint_info (); |
| 159 } | 159 } |
| 160 | 160 |
| 161 static void | 161 static void |
| 162 tui_event_modify_breakpoint (struct breakpoint *b) | 162 tui_event_modify_breakpoint (struct breakpoint *b) |
| 163 { | 163 { |
| 164 tui_update_all_breakpoint_info (); | 164 tui_update_all_breakpoint_info (); |
| 165 } | 165 } |
| 166 | 166 |
| 167 /* Called when going to wait for the target. | 167 /* Called when a command is about to proceed the inferior. */ |
| 168 Leave curses mode and setup program mode. */ | 168 |
| 169 static ptid_t | 169 static void |
| 170 tui_target_wait_hook (ptid_t pid, | 170 tui_about_to_proceed (void) |
| 171 » » struct target_waitstatus *status, int options) | |
| 172 { | 171 { |
| 173 ptid_t res; | |
| 174 | |
| 175 /* Leave tui mode (optional). */ | 172 /* Leave tui mode (optional). */ |
| 176 #if 0 | 173 #if 0 |
| 177 if (tui_active) | 174 if (tui_active) |
| 178 { | 175 { |
| 179 target_terminal_ours (); | 176 target_terminal_ours (); |
| 180 endwin (); | 177 endwin (); |
| 181 target_terminal_inferior (); | 178 target_terminal_inferior (); |
| 182 } | 179 } |
| 183 #endif | 180 #endif |
| 184 tui_target_has_run = 1; | 181 tui_target_has_run = 1; |
| 185 res = target_wait (pid, status, options); | |
| 186 | |
| 187 if (tui_active) | |
| 188 { | |
| 189 /* TODO: need to refresh (optional). */ | |
| 190 } | |
| 191 return res; | |
| 192 } | 182 } |
| 193 | 183 |
| 194 /* The selected frame has changed. This is happens after a target | 184 /* The selected frame has changed. This is happens after a target |
| 195 stop or when the user explicitly changes the frame | 185 stop or when the user explicitly changes the frame |
| 196 (up/down/thread/...). */ | 186 (up/down/thread/...). */ |
| 197 static void | 187 static void |
| 198 tui_selected_frame_level_changed_hook (int level) | 188 tui_selected_frame_level_changed_hook (int level) |
| 199 { | 189 { |
| 200 struct frame_info *fi; | 190 struct frame_info *fi; |
| 201 CORE_ADDR pc; | 191 CORE_ADDR pc; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 static void | 228 static void |
| 239 tui_print_frame_info_listing_hook (struct symtab *s, | 229 tui_print_frame_info_listing_hook (struct symtab *s, |
| 240 int line, | 230 int line, |
| 241 int stopline, | 231 int stopline, |
| 242 int noerror) | 232 int noerror) |
| 243 { | 233 { |
| 244 select_source_symtab (s); | 234 select_source_symtab (s); |
| 245 tui_show_frame_info (get_selected_frame (NULL)); | 235 tui_show_frame_info (get_selected_frame (NULL)); |
| 246 } | 236 } |
| 247 | 237 |
| 248 /* Called when the target process died or is detached. | 238 /* Perform all necessary cleanups regarding our module's inferior data |
| 249 Update the status line. */ | 239 that is required after the inferior INF just exited. */ |
| 240 |
| 250 static void | 241 static void |
| 251 tui_detach_hook (void) | 242 tui_inferior_exit (struct inferior *inf) |
| 252 { | 243 { |
| 244 /* Leave the SingleKey mode to make sure the gdb prompt is visible. */ |
| 245 tui_set_key_mode (TUI_COMMAND_MODE); |
| 253 tui_show_frame_info (0); | 246 tui_show_frame_info (0); |
| 254 tui_display_main (); | 247 tui_display_main (); |
| 255 } | 248 } |
| 256 | 249 |
| 257 /* Observers created when installing TUI hooks. */ | 250 /* Observers created when installing TUI hooks. */ |
| 258 static struct observer *tui_bp_created_observer; | 251 static struct observer *tui_bp_created_observer; |
| 259 static struct observer *tui_bp_deleted_observer; | 252 static struct observer *tui_bp_deleted_observer; |
| 260 static struct observer *tui_bp_modified_observer; | 253 static struct observer *tui_bp_modified_observer; |
| 254 static struct observer *tui_inferior_exit_observer; |
| 255 static struct observer *tui_about_to_proceed_observer; |
| 261 | 256 |
| 262 /* Install the TUI specific hooks. */ | 257 /* Install the TUI specific hooks. */ |
| 263 void | 258 void |
| 264 tui_install_hooks (void) | 259 tui_install_hooks (void) |
| 265 { | 260 { |
| 266 deprecated_target_wait_hook = tui_target_wait_hook; | |
| 267 deprecated_selected_frame_level_changed_hook | 261 deprecated_selected_frame_level_changed_hook |
| 268 = tui_selected_frame_level_changed_hook; | 262 = tui_selected_frame_level_changed_hook; |
| 269 deprecated_print_frame_info_listing_hook | 263 deprecated_print_frame_info_listing_hook |
| 270 = tui_print_frame_info_listing_hook; | 264 = tui_print_frame_info_listing_hook; |
| 271 | 265 |
| 272 deprecated_query_hook = tui_query_hook; | 266 deprecated_query_hook = tui_query_hook; |
| 273 | 267 |
| 274 /* Install the event hooks. */ | 268 /* Install the event hooks. */ |
| 275 tui_bp_created_observer | 269 tui_bp_created_observer |
| 276 = observer_attach_breakpoint_created (tui_event_create_breakpoint); | 270 = observer_attach_breakpoint_created (tui_event_create_breakpoint); |
| 277 tui_bp_deleted_observer | 271 tui_bp_deleted_observer |
| 278 = observer_attach_breakpoint_deleted (tui_event_delete_breakpoint); | 272 = observer_attach_breakpoint_deleted (tui_event_delete_breakpoint); |
| 279 tui_bp_modified_observer | 273 tui_bp_modified_observer |
| 280 = observer_attach_breakpoint_modified (tui_event_modify_breakpoint); | 274 = observer_attach_breakpoint_modified (tui_event_modify_breakpoint); |
| 275 tui_inferior_exit_observer |
| 276 = observer_attach_inferior_exit (tui_inferior_exit); |
| 277 tui_about_to_proceed_observer |
| 278 = observer_attach_about_to_proceed (tui_about_to_proceed); |
| 281 | 279 |
| 282 deprecated_register_changed_hook = tui_register_changed_hook; | 280 deprecated_register_changed_hook = tui_register_changed_hook; |
| 283 deprecated_detach_hook = tui_detach_hook; | |
| 284 } | 281 } |
| 285 | 282 |
| 286 /* Remove the TUI specific hooks. */ | 283 /* Remove the TUI specific hooks. */ |
| 287 void | 284 void |
| 288 tui_remove_hooks (void) | 285 tui_remove_hooks (void) |
| 289 { | 286 { |
| 290 deprecated_target_wait_hook = 0; | |
| 291 deprecated_selected_frame_level_changed_hook = 0; | 287 deprecated_selected_frame_level_changed_hook = 0; |
| 292 deprecated_print_frame_info_listing_hook = 0; | 288 deprecated_print_frame_info_listing_hook = 0; |
| 293 deprecated_query_hook = 0; | 289 deprecated_query_hook = 0; |
| 294 deprecated_register_changed_hook = 0; | 290 deprecated_register_changed_hook = 0; |
| 295 deprecated_detach_hook = 0; | |
| 296 | 291 |
| 297 /* Remove our observers. */ | 292 /* Remove our observers. */ |
| 298 observer_detach_breakpoint_created (tui_bp_created_observer); | 293 observer_detach_breakpoint_created (tui_bp_created_observer); |
| 299 tui_bp_created_observer = NULL; | 294 tui_bp_created_observer = NULL; |
| 300 observer_detach_breakpoint_deleted (tui_bp_deleted_observer); | 295 observer_detach_breakpoint_deleted (tui_bp_deleted_observer); |
| 301 tui_bp_deleted_observer = NULL; | 296 tui_bp_deleted_observer = NULL; |
| 302 observer_detach_breakpoint_modified (tui_bp_modified_observer); | 297 observer_detach_breakpoint_modified (tui_bp_modified_observer); |
| 303 tui_bp_modified_observer = NULL; | 298 tui_bp_modified_observer = NULL; |
| 299 observer_detach_inferior_exit (tui_inferior_exit_observer); |
| 300 tui_inferior_exit_observer = NULL; |
| 301 observer_detach_about_to_proceed (tui_about_to_proceed_observer); |
| 302 tui_about_to_proceed_observer = NULL; |
| 304 } | 303 } |
| 305 | 304 |
| 306 void _initialize_tui_hooks (void); | 305 void _initialize_tui_hooks (void); |
| 307 | 306 |
| 308 void | 307 void |
| 309 _initialize_tui_hooks (void) | 308 _initialize_tui_hooks (void) |
| 310 { | 309 { |
| 311 /* Install the permanent hooks. */ | 310 /* Install the permanent hooks. */ |
| 312 observer_attach_new_objfile (tui_new_objfile_hook); | 311 observer_attach_new_objfile (tui_new_objfile_hook); |
| 313 } | 312 } |
| OLD | NEW |