This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Fix bug in MI -data-list-register-values, PSEUDO_REGS ignored


Hi!

That´s the first time a send a patch here, sorry if I´m doing anything wrong.

Problem: -data-list-register-values gives an error about invalid register number for some registers reported by -data-list-register-names.

Outch!


Solution: The real problem is that mi_cmd_data_list_register_names computes "numregs = NUM_REGS + NUM_PSEUDO_REGS" but mi_cmd_data_list_register_values computes "numregs = NUM_REGS". So the solution is to also compute the pseudo registers.

The patch is trivial and is attached.
I thing the Changelog entry should be something like:

2004-08-25 Salvador E. Tropea <set@users.sf.net>

   * mi/mi-main.c (mi_cmd_data_list_register_values): Fixed wrong
   register number computation.

I've checked in the attached - I stumbled across a few more cases of the same bug. Thanks!


Andrew

Index: ChangeLog
2004-09-12  Salvador E. Tropea  <set@users.sf.net>
	    Andrew Cagney  <cagney@gnu.org>

	* mi/mi-main.c (mi_cmd_data_list_changed_registers) 
	(mi_cmd_data_list_register_values) 
	(mi_cmd_data_write_register_values): Include the PSEUDO_REGS in
	the register number computation.

Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.64
diff -p -u -r1.64 mi-main.c
--- mi/mi-main.c	3 Aug 2004 00:57:27 -0000	1.64
+++ mi/mi-main.c	12 Sep 2004 14:48:17 -0000
@@ -327,7 +327,7 @@ mi_cmd_data_list_changed_registers (char
      case, some entries of REGISTER_NAME will change depending upon
      the particular processor being debugged.  */
 
-  numregs = NUM_REGS;
+  numregs = NUM_REGS + NUM_PSEUDO_REGS;
 
   cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changed-registers");
 
@@ -423,7 +423,7 @@ mi_cmd_data_list_register_values (char *
      case, some entries of REGISTER_NAME will change depending upon
      the particular processor being debugged.  */
 
-  numregs = NUM_REGS;
+  numregs = NUM_REGS + NUM_PSEUDO_REGS;
 
   if (argc == 0)
     {
@@ -563,7 +563,7 @@ mi_cmd_data_write_register_values (char 
      case, some entries of REGISTER_NAME will change depending upon
      the particular processor being debugged.  */
 
-  numregs = NUM_REGS;
+  numregs = NUM_REGS + NUM_PSEUDO_REGS;
 
   if (argc == 0)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]