From: Nathan Sidwell <nathan@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [m68k] Correct dwarf register numbering
Date: Mon, 05 Jun 2006 15:16:00 -0000 [thread overview]
Message-ID: <44844A58.6090200@codesourcery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
The m68k port was using a one-to-one mapping between dwarf register numbers and
gdb register numbers. That's incorrect as the floating point registers have
dwarf numbers 16..23 but gdb register numbers 18..25. Furthermore, GCC
indicates the return column is register 25, which maps onto the last fp register.
This patch adds a mapping function. ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
[-- Attachment #2: dwarf-reg.patch --]
[-- Type: text/x-patch, Size: 2311 bytes --]
2006-06-05 Nathan Sidwell <nathan@codesourcery.com>
* gdb/m68k-tdep.c (m68k_dwarf_reg_to_regnum): New.
(m68k_gdbarch_init): Set it for dwarf & dwarf2 reg number
conversion. Use M68K_NUM_REGS for number of regs.
Index: gdb/m68k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68k-tdep.c,v
retrieving revision 1.105.2.3
diff -c -3 -p -r1.105.2.3 m68k-tdep.c
*** gdb/m68k-tdep.c 5 Jun 2006 14:51:35 -0000 1.105.2.3
--- gdb/m68k-tdep.c 5 Jun 2006 14:55:01 -0000
*************** m68k_push_dummy_call (struct gdbarch *gd
*** 555,560 ****
--- 557,584 ----
frame's CFA. */
return sp + 8;
}
+
+ /* Convert a dwarf or dwarf2 regnumber to a GDB regnum */
+
+ static int
+ m68k_dwarf_reg_to_regnum (int num)
+ {
+ if (num < 8)
+ /* d0..7 */
+ return (num - 0) + M68K_D0_REGNUM;
+ else if (num < 16)
+ /* a0..7 */
+ return (num - 8) + M68K_A0_REGNUM;
+ else if (num < 24)
+ /* fp0..7 */
+ return (num - 16) + M68K_FP0_REGNUM;
+ else if (num == 25)
+ /* pc */
+ return M68K_PC_REGNUM;
+ else
+ return NUM_REGS + NUM_PSEUDO_REGS;
+ }
+
\f
struct m68k_frame_cache
{
*************** m68k_gdbarch_init (struct gdbarch_info i
*** 1240,1249 ****
set_gdbarch_decr_pc_after_break (gdbarch, 2);
set_gdbarch_frame_args_skip (gdbarch, 8);
set_gdbarch_register_type (gdbarch, m68k_register_type);
set_gdbarch_register_name (gdbarch, m68k_register_name);
! set_gdbarch_num_regs (gdbarch, 29);
set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
--- 1264,1275 ----
set_gdbarch_decr_pc_after_break (gdbarch, 2);
set_gdbarch_frame_args_skip (gdbarch, 8);
+ set_gdbarch_dwarf_reg_to_regnum (gdbarch, m68k_dwarf_reg_to_regnum);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, m68k_dwarf_reg_to_regnum);
set_gdbarch_register_type (gdbarch, m68k_register_type);
set_gdbarch_register_name (gdbarch, m68k_register_name);
! set_gdbarch_num_regs (gdbarch, M68K_NUM_REGS);
set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
next reply other threads:[~2006-06-05 15:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-05 15:16 Nathan Sidwell [this message]
2006-06-08 18:14 ` Daniel Jacobowitz
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=44844A58.6090200@codesourcery.com \
--to=nathan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/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