This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fix tui register window
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH]: Fix tui register window
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Sat, 21 Jul 2001 21:52:21 +0200
Hi!
I've committed the following patch that fixes the display in the TUI
register window:
- the register formatting uses 16 characters to print the register name
the effect is that the `<name> <hex> <dec>' string is too big to fit
in the register window and it is truncated. The patch reduces to 8 chars
the name of register (until some best solution is found).
- it's necessary to touch the window when the register has changed.
Stephane
2001-07-21 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* tuiRegs.c (tuiDisplayRegistersFrom): Call touchwin.
(_tuiRegisterFormat): Reduce size of format result.
Index: tuiRegs.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiRegs.c,v
retrieving revision 1.9
diff -u -p -r1.9 tuiRegs.c
--- tuiRegs.c 2001/07/19 22:47:46 1.9
+++ tuiRegs.c 2001/07/21 19:46:08
@@ -347,6 +347,8 @@ tuiDisplayRegistersFrom (int startElemen
makeWindow (dataItemWin, DONT_BOX_WINDOW);
scrollok (dataItemWin->handle, FALSE);
}
+ touchwin (dataItemWin->handle);
+
/*
** Get the printable representation of the register
** and display it
@@ -603,6 +605,7 @@ _tuiRegisterFormat (char *buf, int bufLe
char *name;
struct cleanup *cleanups;
char *p;
+ int pos;
name = REGISTER_NAME (regNum);
if (name == 0)
@@ -619,7 +622,23 @@ _tuiRegisterFormat (char *buf, int bufLe
do_registers_info (regNum, 0);
/* Save formatted output in the buffer. */
- strncpy (buf, tui_file_get_strbuf (stream), bufLen);
+ p = tui_file_get_strbuf (stream);
+ pos = 0;
+ while (*p && *p == *name++ && bufLen)
+ {
+ *buf++ = *p++;
+ bufLen--;
+ pos++;
+ }
+ while (*p == ' ')
+ p++;
+ while (pos < 8 && bufLen)
+ {
+ *buf++ = ' ';
+ bufLen--;
+ pos++;
+ }
+ strncpy (buf, p, bufLen);
/* Remove the possible \n. */
p = strchr (buf, '\n');