This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[PATCH] gdb_regnames should take regnum as parameter
- To: Insight Maling List <insight at sources dot redhat dot com>
- Subject: [PATCH] gdb_regnames should take regnum as parameter
- From: Keith Seitz <keiths at cygnus dot com>
- Date: Tue, 17 Jul 2001 16:16:06 -0700 (PDT)
Hi,
I've committed the following patch, which fixes a long standing bug:
(gdb) tk llength [gdb_regnames 0]
23
(In case it's not obvious, "gdb_regnames 0" should return the name for
register 0 ONLY, i.e., llength should be 1.)
I've also taken the liberty to whack the STREQ in this function, too.
Keith
ChangeLog
2001-07-17 Keith Seitz <keiths@redhat.com>
* generic/gdbtk-register.c (gdb_regnames): Don't skip
past the argument unless it is "-numbers"
Use strncmp instead of STREQ.
Patch
Index: gdbtk/generic/gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.1
diff -u -p -r1.1 gdbtk-register.c
--- gdbtk-register.c 2001/05/10 18:04:23 1.1
+++ gdbtk-register.c 2001/07/17 23:12:46
@@ -156,11 +156,14 @@ gdb_regnames (clientData, interp, objc,
if (objc >= 1)
{
- char *s = Tcl_GetStringFromObj (objv[0], NULL);
- if (STREQ (s, "-numbers"))
- numbers = 1;
- objc--;
- objv++;
+ int len;
+ char *s = Tcl_GetStringFromObj (objv[0], &len);
+ if (strncmp (s, "-numbers", len) == 0)
+ {
+ numbers = 1;
+ objc--;
+ objv++;
+ }
}
return map_arg_registers (objc, objv, get_register_name, &numbers);