Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [patch] mips-tdep: info registers
Date: Fri, 06 Mar 2009 14:52:00 -0000	[thread overview]
Message-ID: <gordae$hec$1@ger.gmane.org> (raw)
In-Reply-To: <20090306122450.GA14439@caradoc.them.org>

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

Daniel Jacobowitz wrote:
> On Fri, Mar 06, 2009 at 12:00:31AM -0500, Aleksandar Ristovski wrote:
>> Maybe adding gdbarch_regname_to_regnum or something like that (which would 
>> avoid iterating through the registers and comparing returned register 
>> names).
> 
> Let's keep optimization separate from functionality; there's a
> function in user-regs.h to do the lookup and if it's too slow it can
> be converted to use a hash table.
> 

I didn't really think about optimization, but I did not 
understand what/how user-regs is being used. Now I realize 
that is the mechanism for adding register aliases.

Here is another try.

(again, tested on in-house gdb variant).

ChangeLog:


* mips-tdep.c (mips_numeric_register_alieses): New definition.
(mips_gdbarch_init): Add user registers from
mips_numeric_register_aliases.

[-- Attachment #2: mips-tdep.c-numeric-register-names-20090306.diff --]
[-- Type: text/x-patch, Size: 1242 bytes --]

Index: gdb/mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.490
diff -u -p -r1.490 mips-tdep.c
--- gdb/mips-tdep.c	22 Feb 2009 01:02:17 -0000	1.490
+++ gdb/mips-tdep.c	6 Mar 2009 14:43:42 -0000
@@ -143,6 +143,15 @@ const struct register_alias mips_registe
   { "fsr", MIPS_EMBED_FP0_REGNUM + 32 }
 };
 
+const struct register_alias mips_numeric_register_aliases[] = {
+#define R(n) { #n, n }
+  R(0), R(1), R(2), R(3), R(4), R(5), R(6), R(7),
+  R(8), R(9), R(10), R(11), R(12), R(13), R(14), R(15),
+  R(16), R(17), R(18), R(19), R(20), R(21), R(22), R(23),
+  R(24), R(25), R(26), R(27), R(28), R(29), R(30), R(31),
+#undef R
+};
+
 #ifndef MIPS_DEFAULT_FPU_TYPE
 #define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_DOUBLE
 #endif
@@ -6058,6 +6067,11 @@ mips_gdbarch_init (struct gdbarch_info i
     user_reg_add (gdbarch, mips_register_aliases[i].name,
 		  value_of_mips_user_reg, &mips_register_aliases[i].regnum);
 
+  for (i = 0; i < ARRAY_SIZE (mips_numeric_register_aliases); i++)
+    user_reg_add (gdbarch, mips_numeric_register_aliases[i].name,
+		  value_of_mips_user_reg, 
+		  &mips_numeric_register_aliases[i].regnum);
+
   return gdbarch;
 }
 

  reply	other threads:[~2009-03-06 14:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 16:24 Aleksandar Ristovski
2009-02-23  2:52 ` Joel Brobecker
2009-02-23  3:00   ` Daniel Jacobowitz
2009-02-23  3:13     ` Joel Brobecker
2009-02-23  8:53       ` Eli Zaretskii
2009-02-23 16:18         ` Aleksandar Ristovski
2009-02-24  1:32           ` Eli Zaretskii
2009-02-23  8:56     ` Mark Kettenis
2009-02-23 16:26       ` Aleksandar Ristovski
2009-02-23 17:15         ` Daniel Jacobowitz
2009-02-23 17:36           ` Joel Brobecker
2009-02-23 18:24             ` Aleksandar Ristovski
2009-02-23 20:02               ` Aleksandar Ristovski
2009-02-27 20:36                 ` Joel Brobecker
2009-03-04 21:47                   ` Aleksandar Ristovski
2009-03-05 19:12                     ` Joel Brobecker
2009-03-05 19:22                       ` Daniel Jacobowitz
2009-03-05 19:27                         ` Aleksandar Ristovski
2009-03-05 19:35                           ` Daniel Jacobowitz
2009-03-05 22:50                             ` Joel Brobecker
2009-03-05 23:08                               ` Daniel Jacobowitz
2009-03-06  5:00                                 ` Aleksandar Ristovski
2009-03-06 12:25                                   ` Daniel Jacobowitz
2009-03-06 14:52                                     ` Aleksandar Ristovski [this message]
2009-04-01 18:50                                       ` Joel Brobecker
2009-04-01 19:16                                         ` Aleksandar Ristovski
2009-02-24 20:24               ` Maciej W. Rozycki
2009-02-25  2:15                 ` Aleksandar Ristovski
2009-02-25  7:04                   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='gordae$hec$1@ger.gmane.org' \
    --to=aristovski@qnx.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox