GDB (API)
/home/stan/gdb/src/gdb/tui/tui-regs.c
Go to the documentation of this file.
00001 /* TUI display registers in window.
00002 
00003    Copyright (C) 1998-2013 Free Software Foundation, Inc.
00004 
00005    Contributed by Hewlett-Packard Company.
00006 
00007    This file is part of GDB.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 3 of the License, or
00012    (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00021 
00022 #include "defs.h"
00023 #include "arch-utils.h"
00024 #include "tui/tui.h"
00025 #include "tui/tui-data.h"
00026 #include "symtab.h"
00027 #include "gdbtypes.h"
00028 #include "gdbcmd.h"
00029 #include "frame.h"
00030 #include "regcache.h"
00031 #include "inferior.h"
00032 #include "target.h"
00033 #include "gdb_string.h"
00034 #include "tui/tui-layout.h"
00035 #include "tui/tui-win.h"
00036 #include "tui/tui-windata.h"
00037 #include "tui/tui-wingeneral.h"
00038 #include "tui/tui-file.h"
00039 #include "tui/tui-regs.h"
00040 #include "reggroups.h"
00041 #include "valprint.h"
00042 
00043 #include "gdb_curses.h"
00044 
00045 
00046 /*****************************************
00047 ** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
00048 ******************************************/
00049 static void
00050 tui_display_register (struct tui_data_element *data,
00051                       struct tui_gen_win_info *win_info);
00052 
00053 static enum tui_status tui_show_register_group (struct reggroup *group,
00054                                                 struct frame_info *frame,
00055                                                 int refresh_values_only);
00056 
00057 static enum tui_status tui_get_register (struct frame_info *frame,
00058                                          struct tui_data_element *data,
00059                                          int regnum, int *changedp);
00060 
00061 static void tui_scroll_regs_forward_command (char *, int);
00062 static void tui_scroll_regs_backward_command (char *, int);
00063 
00064 
00065 
00066 /*****************************************
00067 ** PUBLIC FUNCTIONS                     **
00068 ******************************************/
00069 
00070 /* Answer the number of the last line in the regs display.  If there
00071    are no registers (-1) is returned.  */
00072 int
00073 tui_last_regs_line_no (void)
00074 {
00075   int num_lines = (-1);
00076 
00077   if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
00078     {
00079       num_lines = (TUI_DATA_WIN->detail.data_display_info.regs_content_count /
00080                   TUI_DATA_WIN->detail.data_display_info.regs_column_count);
00081       if (TUI_DATA_WIN->detail.data_display_info.regs_content_count %
00082           TUI_DATA_WIN->detail.data_display_info.regs_column_count)
00083         num_lines++;
00084     }
00085   return num_lines;
00086 }
00087 
00088 
00089 /* Answer the line number that the register element at element_no is
00090    on.  If element_no is greater than the number of register elements
00091    there are, -1 is returned.  */
00092 int
00093 tui_line_from_reg_element_no (int element_no)
00094 {
00095   if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
00096     {
00097       int i, line = (-1);
00098 
00099       i = 1;
00100       while (line == (-1))
00101         {
00102           if (element_no <
00103               (TUI_DATA_WIN->detail.data_display_info.regs_column_count * i))
00104             line = i - 1;
00105           else
00106             i++;
00107         }
00108 
00109       return line;
00110     }
00111   else
00112     return (-1);
00113 }
00114 
00115 
00116 /* Answer the index of the first element in line_no.  If line_no is
00117    past the register area (-1) is returned.  */
00118 int
00119 tui_first_reg_element_no_inline (int line_no)
00120 {
00121   if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count)
00122       <= TUI_DATA_WIN->detail.data_display_info.regs_content_count)
00123     return ((line_no + 1) *
00124             TUI_DATA_WIN->detail.data_display_info.regs_column_count) -
00125       TUI_DATA_WIN->detail.data_display_info.regs_column_count;
00126   else
00127     return (-1);
00128 }
00129 
00130 
00131 /* Show the registers of the given group in the data window
00132    and refresh the window.  */
00133 void
00134 tui_show_registers (struct reggroup *group)
00135 {
00136   enum tui_status ret = TUI_FAILURE;
00137   struct tui_data_info *display_info;
00138 
00139   /* Make sure the curses mode is enabled.  */
00140   tui_enable ();
00141 
00142   /* Make sure the register window is visible.  If not, select an
00143      appropriate layout.  */
00144   if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->generic.is_visible)
00145     tui_set_layout_for_display_command (DATA_NAME);
00146 
00147   display_info = &TUI_DATA_WIN->detail.data_display_info;
00148   if (group == 0)
00149     group = general_reggroup;
00150 
00151   /* Say that registers should be displayed, even if there is a
00152      problem.  */
00153   display_info->display_regs = TRUE;
00154 
00155   if (target_has_registers && target_has_stack && target_has_memory)
00156     {
00157       ret = tui_show_register_group (group, get_selected_frame (NULL),
00158                                      group == display_info->current_group);
00159     }
00160   if (ret == TUI_FAILURE)
00161     {
00162       display_info->current_group = 0;
00163       tui_erase_data_content (NO_REGS_STRING);
00164     }
00165   else
00166     {
00167       int i;
00168 
00169       /* Clear all notation of changed values.  */
00170       for (i = 0; i < display_info->regs_content_count; i++)
00171         {
00172           struct tui_gen_win_info *data_item_win;
00173           struct tui_win_element *win;
00174 
00175           data_item_win = &display_info->regs_content[i]
00176             ->which_element.data_window;
00177           win = (struct tui_win_element *) data_item_win->content[0];
00178           win->which_element.data.highlight = FALSE;
00179         }
00180       display_info->current_group = group;
00181       tui_display_all_data ();
00182     }
00183 }
00184 
00185 
00186 /* Set the data window to display the registers of the register group
00187    using the given frame.  Values are refreshed only when
00188    refresh_values_only is TRUE.  */
00189 
00190 static enum tui_status
00191 tui_show_register_group (struct reggroup *group,
00192                          struct frame_info *frame, 
00193                          int refresh_values_only)
00194 {
00195   struct gdbarch *gdbarch = get_frame_arch (frame);
00196   enum tui_status ret = TUI_FAILURE;
00197   int nr_regs;
00198   int allocated_here = FALSE;
00199   int regnum, pos;
00200   char title[80];
00201   struct tui_data_info *display_info = &TUI_DATA_WIN->detail.data_display_info;
00202 
00203   /* Make a new title showing which group we display.  */
00204   snprintf (title, sizeof (title) - 1, "Register group: %s",
00205             reggroup_name (group));
00206   xfree (TUI_DATA_WIN->generic.title);
00207   TUI_DATA_WIN->generic.title = xstrdup (title);
00208 
00209   /* See how many registers must be displayed.  */
00210   nr_regs = 0;
00211   for (regnum = 0;
00212        regnum < gdbarch_num_regs (gdbarch)
00213                 + gdbarch_num_pseudo_regs (gdbarch);
00214        regnum++)
00215     {
00216       const char *name;
00217 
00218       /* Must be in the group.  */
00219       if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
00220         continue;
00221 
00222       /* If the register name is empty, it is undefined for this
00223          processor, so don't display anything.  */
00224       name = gdbarch_register_name (gdbarch, regnum);
00225       if (name == 0 || *name == '\0')
00226         continue;
00227 
00228       nr_regs++;
00229     }
00230 
00231   if (display_info->regs_content_count > 0 && !refresh_values_only)
00232     {
00233       tui_free_data_content (display_info->regs_content,
00234                              display_info->regs_content_count);
00235       display_info->regs_content_count = 0;
00236     }
00237 
00238   if (display_info->regs_content_count <= 0)
00239     {
00240       display_info->regs_content = tui_alloc_content (nr_regs, DATA_WIN);
00241       allocated_here = TRUE;
00242       refresh_values_only = FALSE;
00243     }
00244 
00245   if (display_info->regs_content != (tui_win_content) NULL)
00246     {
00247       if (!refresh_values_only || allocated_here)
00248         {
00249           TUI_DATA_WIN->generic.content = (void*) NULL;
00250           TUI_DATA_WIN->generic.content_size = 0;
00251           tui_add_content_elements (&TUI_DATA_WIN->generic, nr_regs);
00252           display_info->regs_content
00253             = (tui_win_content) TUI_DATA_WIN->generic.content;
00254           display_info->regs_content_count = nr_regs;
00255         }
00256 
00257       /* Now set the register names and values.  */
00258       pos = 0;
00259       for (regnum = 0;
00260            regnum < gdbarch_num_regs (gdbarch)
00261                     + gdbarch_num_pseudo_regs (gdbarch);
00262            regnum++)
00263         {
00264           struct tui_gen_win_info *data_item_win;
00265           struct tui_data_element *data;
00266           const char *name;
00267 
00268           /* Must be in the group.  */
00269           if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
00270             continue;
00271 
00272           /* If the register name is empty, it is undefined for this
00273              processor, so don't display anything.  */
00274           name = gdbarch_register_name (gdbarch, regnum);
00275           if (name == 0 || *name == '\0')
00276             continue;
00277 
00278           data_item_win =
00279             &display_info->regs_content[pos]->which_element.data_window;
00280           data = &((struct tui_win_element *)
00281                    data_item_win->content[0])->which_element.data;
00282           if (data)
00283             {
00284               if (!refresh_values_only)
00285                 {
00286                   data->item_no = regnum;
00287                   data->name = name;
00288                   data->highlight = FALSE;
00289                 }
00290               tui_get_register (frame, data, regnum, 0);
00291             }
00292           pos++;
00293         }
00294 
00295       TUI_DATA_WIN->generic.content_size =
00296         display_info->regs_content_count + display_info->data_content_count;
00297       ret = TUI_SUCCESS;
00298     }
00299 
00300   return ret;
00301 }
00302 
00303 /* Function to display the registers in the content from
00304    'start_element_no' until the end of the register content or the end
00305    of the display height.  No checking for displaying past the end of
00306    the registers is done here.  */
00307 void
00308 tui_display_registers_from (int start_element_no)
00309 {
00310   struct tui_data_info *display_info = &TUI_DATA_WIN->detail.data_display_info;
00311 
00312   if (display_info->regs_content != (tui_win_content) NULL 
00313       && display_info->regs_content_count > 0)
00314     {
00315       int i = start_element_no;
00316       int j, item_win_width, cur_y;
00317 
00318       int max_len = 0;
00319       for (i = 0; i < display_info->regs_content_count; i++)
00320         {
00321           struct tui_data_element *data;
00322           struct tui_gen_win_info *data_item_win;
00323           char *p;
00324           int len;
00325 
00326           data_item_win
00327             = &display_info->regs_content[i]->which_element.data_window;
00328           data = &((struct tui_win_element *)
00329                    data_item_win->content[0])->which_element.data;
00330           len = 0;
00331           p = data->content;
00332           if (p != 0)
00333             while (*p)
00334               {
00335                 if (*p++ == '\t')
00336                   len = 8 * ((len / 8) + 1);
00337                 else
00338                   len++;
00339               }
00340 
00341           if (len > max_len)
00342             max_len = len;
00343         }
00344       item_win_width = max_len + 1;
00345       i = start_element_no;
00346 
00347       display_info->regs_column_count =
00348         (TUI_DATA_WIN->generic.width - 2) / item_win_width;
00349       if (display_info->regs_column_count == 0)
00350         display_info->regs_column_count = 1;
00351       item_win_width =
00352         (TUI_DATA_WIN->generic.width - 2) / display_info->regs_column_count;
00353 
00354       /* Now create each data "sub" window, and write the display into
00355          it.  */
00356       cur_y = 1;
00357       while (i < display_info->regs_content_count 
00358              && cur_y <= TUI_DATA_WIN->generic.viewport_height)
00359         {
00360           for (j = 0;
00361                j < display_info->regs_column_count
00362                  && i < display_info->regs_content_count;
00363                j++)
00364             {
00365               struct tui_gen_win_info *data_item_win;
00366               struct tui_data_element *data_element_ptr;
00367 
00368               /* Create the window if necessary.  */
00369               data_item_win = &display_info->regs_content[i]
00370                 ->which_element.data_window;
00371               data_element_ptr = &((struct tui_win_element *)
00372                                    data_item_win->content[0])->which_element.data;
00373               if (data_item_win->handle != (WINDOW*) NULL
00374                   && (data_item_win->height != 1
00375                       || data_item_win->width != item_win_width
00376                       || data_item_win->origin.x != (item_win_width * j) + 1
00377                       || data_item_win->origin.y != cur_y))
00378                 {
00379                   tui_delete_win (data_item_win->handle);
00380                   data_item_win->handle = 0;
00381                 }
00382                   
00383               if (data_item_win->handle == (WINDOW *) NULL)
00384                 {
00385                   data_item_win->height = 1;
00386                   data_item_win->width = item_win_width;
00387                   data_item_win->origin.x = (item_win_width * j) + 1;
00388                   data_item_win->origin.y = cur_y;
00389                   tui_make_window (data_item_win, DONT_BOX_WINDOW);
00390                   scrollok (data_item_win->handle, FALSE);
00391                 }
00392               touchwin (data_item_win->handle);
00393 
00394               /* Get the printable representation of the register
00395                  and display it.  */
00396               tui_display_register (data_element_ptr, data_item_win);
00397               i++;              /* Next register.  */
00398             }
00399           cur_y++;              /* Next row.  */
00400         }
00401     }
00402 }
00403 
00404 
00405 /* Function to display the registers in the content from
00406    'start_element_no' on 'start_line_no' until the end of the register
00407    content or the end of the display height.  This function checks
00408    that we won't display off the end of the register display.  */
00409 static void
00410 tui_display_reg_element_at_line (int start_element_no,
00411                                  int start_line_no)
00412 {
00413   if (TUI_DATA_WIN->detail.data_display_info.regs_content
00414       != (tui_win_content) NULL
00415       && TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
00416     {
00417       int element_no = start_element_no;
00418 
00419       if (start_element_no != 0 && start_line_no != 0)
00420         {
00421           int last_line_no, first_line_on_last_page;
00422 
00423           last_line_no = tui_last_regs_line_no ();
00424           first_line_on_last_page
00425             = last_line_no - (TUI_DATA_WIN->generic.height - 2);
00426           if (first_line_on_last_page < 0)
00427             first_line_on_last_page = 0;
00428 
00429           /* If there is no other data displayed except registers, and
00430              the element_no causes us to scroll past the end of the
00431              registers, adjust what element to really start the
00432              display at.  */
00433           if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0
00434               && start_line_no > first_line_on_last_page)
00435             element_no
00436               = tui_first_reg_element_no_inline (first_line_on_last_page);
00437         }
00438       tui_display_registers_from (element_no);
00439     }
00440 }
00441 
00442 
00443 
00444 /* Function to display the registers starting at line line_no in the
00445    data window.  Answers the line number that the display actually
00446    started from.  If nothing is displayed (-1) is returned.  */
00447 int
00448 tui_display_registers_from_line (int line_no, 
00449                                  int force_display)
00450 {
00451   if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
00452     {
00453       int line, element_no;
00454 
00455       if (line_no < 0)
00456         line = 0;
00457       else if (force_display)
00458         { /* If we must display regs (force_display is true), then
00459              make sure that we don't display off the end of the
00460              registers.  */
00461           if (line_no >= tui_last_regs_line_no ())
00462             {
00463               if ((line = tui_line_from_reg_element_no (
00464                  TUI_DATA_WIN->detail.data_display_info.regs_content_count - 1)) < 0)
00465                 line = 0;
00466             }
00467           else
00468             line = line_no;
00469         }
00470       else
00471         line = line_no;
00472 
00473       element_no = tui_first_reg_element_no_inline (line);
00474       if (element_no
00475           < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
00476         tui_display_reg_element_at_line (element_no, line);
00477       else
00478         line = (-1);
00479 
00480       return line;
00481     }
00482 
00483   return (-1);                  /* Nothing was displayed.  */
00484 }
00485 
00486 
00487 /* This function check all displayed registers for changes in values,
00488    given a particular frame.  If the values have changed, they are
00489    updated with the new value and highlighted.  */
00490 void
00491 tui_check_register_values (struct frame_info *frame)
00492 {
00493   if (TUI_DATA_WIN != NULL
00494       && TUI_DATA_WIN->generic.is_visible)
00495     {
00496       struct tui_data_info *display_info
00497         = &TUI_DATA_WIN->detail.data_display_info;
00498 
00499       if (display_info->regs_content_count <= 0 
00500           && display_info->display_regs)
00501         tui_show_registers (display_info->current_group);
00502       else
00503         {
00504           int i;
00505 
00506           for (i = 0; (i < display_info->regs_content_count); i++)
00507             {
00508               struct tui_data_element *data;
00509               struct tui_gen_win_info *data_item_win_ptr;
00510               int was_hilighted;
00511 
00512               data_item_win_ptr = &display_info->regs_content[i]->
00513                 which_element.data_window;
00514               data = &((struct tui_win_element *)
00515                        data_item_win_ptr->content[0])->which_element.data;
00516               was_hilighted = data->highlight;
00517 
00518               tui_get_register (frame, data,
00519                                 data->item_no, &data->highlight);
00520 
00521               if (data->highlight || was_hilighted)
00522                 {
00523                   tui_display_register (data, data_item_win_ptr);
00524                 }
00525             }
00526         }
00527     }
00528 }
00529 
00530 /* Display a register in a window.  If hilite is TRUE, then the value
00531    will be displayed in reverse video.  */
00532 static void
00533 tui_display_register (struct tui_data_element *data,
00534                       struct tui_gen_win_info *win_info)
00535 {
00536   if (win_info->handle != (WINDOW *) NULL)
00537     {
00538       int i;
00539 
00540       if (data->highlight)
00541         /* We ignore the return value, casting it to void in order to avoid
00542            a compiler warning.  The warning itself was introduced by a patch
00543            to ncurses 5.7 dated 2009-08-29, changing this macro to expand
00544            to code that causes the compiler to generate an unused-value
00545            warning.  */
00546         (void) wstandout (win_info->handle);
00547       
00548       wmove (win_info->handle, 0, 0);
00549       for (i = 1; i < win_info->width; i++)
00550         waddch (win_info->handle, ' ');
00551       wmove (win_info->handle, 0, 0);
00552       if (data->content)
00553         waddstr (win_info->handle, data->content);
00554 
00555       if (data->highlight)
00556         /* We ignore the return value, casting it to void in order to avoid
00557            a compiler warning.  The warning itself was introduced by a patch
00558            to ncurses 5.7 dated 2009-08-29, changing this macro to expand
00559            to code that causes the compiler to generate an unused-value
00560            warning.  */
00561         (void) wstandend (win_info->handle);
00562       tui_refresh_win (win_info);
00563     }
00564 }
00565 
00566 static void
00567 tui_reg_next_command (char *arg, int from_tty)
00568 {
00569   struct gdbarch *gdbarch = get_current_arch ();
00570 
00571   if (TUI_DATA_WIN != 0)
00572     {
00573       struct reggroup *group
00574         = TUI_DATA_WIN->detail.data_display_info.current_group;
00575 
00576       group = reggroup_next (gdbarch, group);
00577       if (group == 0)
00578         group = reggroup_next (gdbarch, 0);
00579 
00580       if (group)
00581         tui_show_registers (group);
00582     }
00583 }
00584 
00585 static void
00586 tui_reg_float_command (char *arg, int from_tty)
00587 {
00588   tui_show_registers (float_reggroup);
00589 }
00590 
00591 static void
00592 tui_reg_general_command (char *arg, int from_tty)
00593 {
00594   tui_show_registers (general_reggroup);
00595 }
00596 
00597 static void
00598 tui_reg_system_command (char *arg, int from_tty)
00599 {
00600   tui_show_registers (system_reggroup);
00601 }
00602 
00603 static struct cmd_list_element *tuireglist;
00604 
00605 static void
00606 tui_reg_command (char *args, int from_tty)
00607 {
00608   printf_unfiltered (_("\"tui reg\" must be followed by the name of a "
00609                      "tui reg command.\n"));
00610   help_list (tuireglist, "tui reg ", -1, gdb_stdout);
00611 }
00612 
00613 /* Provide a prototype to silence -Wmissing-prototypes.  */
00614 extern initialize_file_ftype _initialize_tui_regs;
00615 
00616 void
00617 _initialize_tui_regs (void)
00618 {
00619   struct cmd_list_element **tuicmd;
00620 
00621   tuicmd = tui_get_cmd_list ();
00622 
00623   add_prefix_cmd ("reg", class_tui, tui_reg_command,
00624                   _("TUI commands to control the register window."),
00625                   &tuireglist, "tui reg ", 0,
00626                   tuicmd);
00627 
00628   add_cmd ("float", class_tui, tui_reg_float_command,
00629            _("Display only floating point registers."),
00630            &tuireglist);
00631   add_cmd ("general", class_tui, tui_reg_general_command,
00632            _("Display only general registers."),
00633            &tuireglist);
00634   add_cmd ("system", class_tui, tui_reg_system_command,
00635            _("Display only system registers."),
00636            &tuireglist);
00637   add_cmd ("next", class_tui, tui_reg_next_command,
00638            _("Display next register group."),
00639            &tuireglist);
00640 
00641   if (xdb_commands)
00642     {
00643       add_com ("fr", class_tui, tui_reg_float_command,
00644                _("Display only floating point registers\n"));
00645       add_com ("gr", class_tui, tui_reg_general_command,
00646                _("Display only general registers\n"));
00647       add_com ("sr", class_tui, tui_reg_system_command,
00648                _("Display only special registers\n"));
00649       add_com ("+r", class_tui, tui_scroll_regs_forward_command,
00650                _("Scroll the registers window forward\n"));
00651       add_com ("-r", class_tui, tui_scroll_regs_backward_command,
00652                _("Scroll the register window backward\n"));
00653     }
00654 }
00655 
00656 
00657 /*****************************************
00658 ** STATIC LOCAL FUNCTIONS                 **
00659 ******************************************/
00660 
00661 static void
00662 tui_restore_gdbout (void *ui)
00663 {
00664   ui_file_delete (gdb_stdout);
00665   gdb_stdout = (struct ui_file*) ui;
00666   pagination_enabled = 1;
00667 }
00668 
00669 /* Get the register from the frame and return a printable
00670    representation of it.  */
00671 
00672 static char *
00673 tui_register_format (struct frame_info *frame, int regnum)
00674 {
00675   struct gdbarch *gdbarch = get_frame_arch (frame);
00676   struct ui_file *stream;
00677   struct ui_file *old_stdout;
00678   struct cleanup *cleanups;
00679   char *p, *s;
00680   char *ret;
00681 
00682   pagination_enabled = 0;
00683   old_stdout = gdb_stdout;
00684   stream = tui_sfileopen (256);
00685   gdb_stdout = stream;
00686   cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout);
00687   gdbarch_print_registers_info (gdbarch, stream, frame, regnum, 1);
00688 
00689   /* Save formatted output in the buffer.  */
00690   p = tui_file_get_strbuf (stream);
00691 
00692   /* Remove the possible \n.  */
00693   s = strrchr (p, '\n');
00694   if (s && s[1] == 0)
00695     *s = 0;
00696 
00697   ret = xstrdup (p);
00698   do_cleanups (cleanups);
00699 
00700   return ret;
00701 }
00702 
00703 /* Get the register value from the given frame and format it for the
00704    display.  When changep is set, check if the new register value has
00705    changed with respect to the previous call.  */
00706 static enum tui_status
00707 tui_get_register (struct frame_info *frame,
00708                   struct tui_data_element *data, 
00709                   int regnum, int *changedp)
00710 {
00711   enum tui_status ret = TUI_FAILURE;
00712 
00713   if (changedp)
00714     *changedp = FALSE;
00715   if (target_has_registers)
00716     {
00717       char *prev_content = data->content;
00718 
00719       data->content = tui_register_format (frame, regnum);
00720 
00721       if (changedp != NULL
00722           && strcmp (prev_content, data->content) != 0)
00723         *changedp = 1;
00724 
00725       xfree (prev_content);
00726 
00727       ret = TUI_SUCCESS;
00728     }
00729   return ret;
00730 }
00731 
00732 static void
00733 tui_scroll_regs_forward_command (char *arg, int from_tty)
00734 {
00735   tui_scroll (FORWARD_SCROLL, TUI_DATA_WIN, 1);
00736 }
00737 
00738 
00739 static void
00740 tui_scroll_regs_backward_command (char *arg, int from_tty)
00741 {
00742   tui_scroll (BACKWARD_SCROLL, TUI_DATA_WIN, 1);
00743 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines