/* Called from print_frame_info to list the line we stopped in. */ static void tui_print_frame_info_listing_hook (struct symtab *s, int line, int stopline, int noerror) { select_source_symtab (s); tui_show_frame_info (deprecated_selected_frame); }
/* The selected frame has changed. This is happens after a target stop or when the user explicitly changes the frame (up/down/thread/...). */ static void tui_selected_frame_level_changed_hook (int level) { struct frame_info *fi; fi = deprecated_selected_frame; /* Ensure that symbols for this frame are read in. Also, determine the source language of this frame, and switch to it if desired. */ if (fi) { struct symtab *s; s = find_pc_symtab (get_frame_pc (fi)); /* elz: this if here fixes the problem with the pc not being displayed in the tui asm layout, with no debug symbols. The value of s would be 0 here, and select_source_symtab would abort the command by calling the 'error' function */ if (s) select_source_symtab (s); /* Display the frame position (even if there is no symbols). */ tui_show_frame_info (fi); /* Refresh the register window if it's visible. */ if (tui_is_window_visible (DATA_WIN)) { tui_refreshing_registers = 1; tui_check_data_values (fi); tui_refreshing_registers = 0; } } }
static void tui_inferior_exit (struct inferior *inf) { /* Leave the SingleKey mode to make sure the gdb prompt is visible. */ tui_set_key_mode (TUI_COMMAND_MODE); tui_show_frame_info (0); tui_display_main (); }
static void tui_refresh_frame_and_register_information (int registers_too_p) { struct frame_info *fi; CORE_ADDR pc; struct cleanup *old_chain; int frame_info_changed_p; if (!has_stack_frames ()) return; old_chain = make_cleanup_restore_target_terminal (); target_terminal_ours_for_output (); fi = get_selected_frame (NULL); /* Ensure that symbols for this frame are read in. Also, determine the source language of this frame, and switch to it if desired. */ if (get_frame_pc_if_available (fi, &pc)) { struct symtab *s; s = find_pc_line_symtab (pc); /* elz: This if here fixes the problem with the pc not being displayed in the tui asm layout, with no debug symbols. The value of s would be 0 here, and select_source_symtab would abort the command by calling the 'error' function. */ if (s) select_source_symtab (s); } /* Display the frame position (even if there is no symbols or the PC is not known). */ frame_info_changed_p = tui_show_frame_info (fi); /* Refresh the register window if it's visible. */ if (tui_is_window_visible (DATA_WIN) && (frame_info_changed_p || registers_too_p)) { tui_refreshing_registers = 1; tui_check_data_values (fi); tui_refreshing_registers = 0; } do_cleanups (old_chain); }
/* Enter in the tui mode (curses). When in normal mode, it installs the tui hooks in gdb, redirects the gdb output, configures the readline to work in tui mode. When in curses mode, it does nothing. */ void tui_enable (void) { if (tui_active) return; /* To avoid to initialize curses when gdb starts, there is a defered curses initialization. This initialization is made only once and the first time the curses mode is entered. */ if (tui_finish_init) { WINDOW *w; w = initscr (); cbreak (); noecho (); /*timeout (1);*/ nodelay(w, FALSE); nl(); keypad (w, TRUE); rl_initialize (); tui_set_term_height_to (LINES); tui_set_term_width_to (COLS); def_prog_mode (); tui_show_frame_info (0); tui_set_layout (SRC_COMMAND, TUI_UNDEFINED_REGS); tui_set_win_focus_to (TUI_SRC_WIN); keypad (TUI_CMD_WIN->generic.handle, TRUE); wrefresh (TUI_CMD_WIN->generic.handle); tui_finish_init = 0; } else { /* Save the current gdb setting of the terminal. Curses will restore this state when endwin() is called. */ def_shell_mode (); clearok (stdscr, TRUE); } /* Install the TUI specific hooks. */ tui_install_hooks (); rl_startup_hook = tui_rl_startup_hook; tui_update_variables (); tui_setup_io (1); tui_active = 1; if (deprecated_selected_frame) tui_show_frame_info (deprecated_selected_frame); /* Restore TUI keymap. */ tui_set_key_mode (tui_current_key_mode); tui_refresh_all_win (); /* Update gdb's knowledge of its terminal. */ target_terminal_save_ours (); tui_update_gdb_sizes (); }
/* Called when the target process died or is detached. Update the status line. */ static void tui_detach_hook (void) { tui_show_frame_info (0); tui_display_main (); }