* tui-hooks.c: Update include order.
[deliverable/binutils-gdb.git] / gdb / tui / tuiRegs.c
index d76c67ea8beea370a1758596c91f2d85f9e5ac4f..9f0b1a4d8451fa6c7b4ea030c4974f8a67259e45 100644 (file)
@@ -1,6 +1,6 @@
 /* TUI display registers in window.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    Contributed by Hewlett-Packard Company.
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
-   "defs.h" should be included first.  Unfortunatly some systems
-   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
-   and they clash with "bfd.h"'s definiton of true/false.  The correct
-   fix is to remove true/false from "bfd.h", however, until that
-   happens, hack around it by including "config.h" and <curses.h>
-   first.  */
-
-#include "config.h"
-#ifdef HAVE_NCURSES_H       
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
-
 #include "defs.h"
 #include "tui.h"
 #include "tuiData.h"
@@ -46,6 +29,7 @@
 #include "gdbtypes.h"
 #include "gdbcmd.h"
 #include "frame.h"
+#include "regcache.h"
 #include "inferior.h"
 #include "target.h"
 #include "tuiLayout.h"
 #include "tuiGeneralWin.h"
 #include "tui-file.h"
 
+#ifdef HAVE_NCURSES_H       
+#include <ncurses.h>
+#else
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#endif
+
 /*****************************************
 ** LOCAL DEFINITIONS                    **
 ******************************************/
@@ -86,7 +78,7 @@
 ******************************************/
 static TuiStatus _tuiSetRegsContent
   (int, int, struct frame_info *, TuiRegisterDisplayType, int);
-static char *_tuiRegisterName (int);
+static const char *_tuiRegisterName (int);
 static TuiStatus _tuiGetRegisterRawValue (int, char *, struct frame_info *);
 static void _tuiSetRegisterElement
   (int, struct frame_info *, TuiDataElementPtr, int);
@@ -311,7 +303,7 @@ tuiDisplayRegistersFrom (int startElementNo)
       dataWin->detail.dataDisplayInfo.regsContentCount > 0)
     {
       register int i = startElementNo;
-      int j, valueCharsWide, charsWide, itemWinWidth, curY, labelWidth;
+      int j, valueCharsWide, itemWinWidth, curY, labelWidth;
       enum precision_type precision;
 
       precision = (dataWin->detail.dataDisplayInfo.regsDisplayType
@@ -435,8 +427,6 @@ tuiDisplayRegElementAtLine (int startElementNo, int startLineNo)
 int
 tuiDisplayRegistersFromLine (int lineNo, int forceDisplay)
 {
-  int elementNo;
-
   if (dataWin->detail.dataDisplayInfo.regsContentCount > 0)
     {
       int line, elementNo;
@@ -490,7 +480,7 @@ tuiCheckRegisterValues (struct frame_info *frame)
       else
        {
          int i, j;
-         char rawBuf[MAX_REGISTER_RAW_SIZE];
+         char rawBuf[MAX_REGISTER_SIZE];
 
          for (i = 0;
               (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++)
@@ -595,7 +585,7 @@ registers.\n",
    ** _tuiRegisterName().
    **        Return the register name.
  */
-static char *
+static const char *
 _tuiRegisterName (int regNum)
 {
   return REGISTER_NAME (regNum);
@@ -622,7 +612,7 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum,
 {
   struct ui_file *stream;
   struct ui_file *old_stdout;
-  char *name;
+  const char *name;
   struct cleanup *cleanups;
   char *p;
   int pos;
@@ -639,7 +629,8 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum,
   stream = tui_sfileopen (bufLen);
   gdb_stdout = stream;
   cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout);
-  do_registers_info (regNum, 0);
+  gdbarch_print_registers_info (current_gdbarch, stream, deprecated_selected_frame,
+                                regNum, 1);
 
   /* Save formatted output in the buffer.  */
   p = tui_file_get_strbuf (stream);
@@ -679,7 +670,7 @@ _tuiSetGeneralRegsContent (int refreshValuesOnly)
 {
   return (_tuiSetRegsContent (0,
                              NUM_GENERAL_REGS - 1,
-                             selected_frame,
+                             deprecated_selected_frame,
                              TUI_GENERAL_REGS,
                              refreshValuesOnly));
 
@@ -700,18 +691,12 @@ static TuiStatus
 _tuiSetSpecialRegsContent (int refreshValuesOnly)
 {
   TuiStatus ret = TUI_FAILURE;
-  int i, endRegNum;
+  int endRegNum;
 
   endRegNum = FP0_REGNUM - 1;
-#if 0
-  endRegNum = (-1);
-  for (i = START_SPECIAL_REGS; (i < NUM_REGS && endRegNum < 0); i++)
-    if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
-      endRegNum = i - 1;
-#endif
   ret = _tuiSetRegsContent (START_SPECIAL_REGS,
                            endRegNum,
-                           selected_frame,
+                           deprecated_selected_frame,
                            TUI_SPECIAL_REGS,
                            refreshValuesOnly);
 
@@ -727,17 +712,11 @@ static TuiStatus
 _tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly)
 {
   TuiStatus ret = TUI_FAILURE;
-  int i, endRegNum = (-1);
+  int endRegNum = (-1);
 
   endRegNum = FP0_REGNUM - 1;
-#if 0
-  endRegNum = (-1);
-  for (i = 0; (i < NUM_REGS && endRegNum < 0); i++)
-    if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
-      endRegNum = i - 1;
-#endif
   ret = _tuiSetRegsContent (
-        0, endRegNum, selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly);
+        0, endRegNum, deprecated_selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly);
 
   return ret;
 }                              /* _tuiSetGeneralAndSpecialRegsContent */
@@ -750,18 +729,12 @@ static TuiStatus
 _tuiSetFloatRegsContent (TuiRegisterDisplayType dpyType, int refreshValuesOnly)
 {
   TuiStatus ret = TUI_FAILURE;
-  int i, startRegNum;
+  int startRegNum;
 
   startRegNum = FP0_REGNUM;
-#if 0
-  startRegNum = (-1);
-  for (i = NUM_REGS - 1; (i >= 0 && startRegNum < 0); i--)
-    if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) != TYPE_CODE_FLT)
-      startRegNum = i + 1;
-#endif
   ret = _tuiSetRegsContent (startRegNum,
                            NUM_REGS - 1,
-                           selected_frame,
+                           deprecated_selected_frame,
                            dpyType,
                            refreshValuesOnly);
 
@@ -784,7 +757,7 @@ _tuiRegValueHasChanged (TuiDataElementPtr dataElement,
   if (dataElement->itemNo != UNDEFINED_ITEM &&
       _tuiRegisterName (dataElement->itemNo) != (char *) NULL)
     {
-      char rawBuf[MAX_REGISTER_RAW_SIZE];
+      char rawBuf[MAX_REGISTER_SIZE];
       int i;
 
       if (_tuiGetRegisterRawValue (
@@ -817,10 +790,10 @@ _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame)
 
   if (target_has_registers)
     {
-      int opt;
-      
-      get_saved_register (regValue, &opt, (CORE_ADDR*) NULL, frame,
-                         regNum, (enum lval_type*) NULL);
+      frame_read_register (frame, regNum, regValue);
+      /* NOTE: cagney/2003-03-13: This is bogus.  It is refering to
+         the register cache and not the frame which could have pulled
+         the register value off the stack.  */
       if (register_cached (regNum) >= 0)
        ret = TUI_SUCCESS;
     }
@@ -848,7 +821,7 @@ _tuiSetRegisterElement (int regNum, struct frame_info *frame,
          dataElement->highlight = FALSE;
        }
       if (dataElement->value == (Opaque) NULL)
-       dataElement->value = (Opaque) xmalloc (MAX_REGISTER_RAW_SIZE);
+       dataElement->value = (Opaque) xmalloc (MAX_REGISTER_SIZE);
       if (dataElement->value != (Opaque) NULL)
        _tuiGetRegisterRawValue (regNum, dataElement->value, frame);
     }
This page took 0.026674 seconds and 4 git commands to generate.