static const char *amd64_byte_names[] =
{
"al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
- "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
+ "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l",
+ "ah", "bh", "ch", "dh"
};
+/* Number of lower byte registers. */
+#define AMD64_NUM_LOWER_BYTE_REGS 16
+
/* Register names for word pseudo-registers. */
static const char *amd64_word_names[] =
int gpnum = regnum - tdep->al_regnum;
/* Extract (always little endian). */
- regcache_raw_read (regcache, gpnum, raw_buf);
- memcpy (buf, raw_buf, 1);
+ if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
+ {
+ /* Special handling for AH, BH, CH, DH. */
+ regcache_raw_read (regcache,
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+ memcpy (buf, raw_buf + 1, 1);
+ }
+ else
+ {
+ regcache_raw_read (regcache, gpnum, raw_buf);
+ memcpy (buf, raw_buf, 1);
+ }
}
else if (i386_dword_regnum_p (gdbarch, regnum))
{
{
int gpnum = regnum - tdep->al_regnum;
- /* Read ... */
- regcache_raw_read (regcache, gpnum, raw_buf);
- /* ... Modify ... (always little endian). */
- memcpy (raw_buf, buf, 1);
- /* ... Write. */
- regcache_raw_write (regcache, gpnum, raw_buf);
+ if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
+ {
+ /* Read ... AH, BH, CH, DH. */
+ regcache_raw_read (regcache,
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+ /* ... Modify ... (always little endian). */
+ memcpy (raw_buf + 1, buf, 1);
+ /* ... Write. */
+ regcache_raw_write (regcache,
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+ }
+ else
+ {
+ /* Read ... */
+ regcache_raw_read (regcache, gpnum, raw_buf);
+ /* ... Modify ... (always little endian). */
+ memcpy (raw_buf, buf, 1);
+ /* ... Write. */
+ regcache_raw_write (regcache, gpnum, raw_buf);
+ }
}
else if (i386_dword_regnum_p (gdbarch, regnum))
{
tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS;
tdep->register_names = amd64_register_names;
- tdep->num_byte_regs = 16;
+ tdep->num_byte_regs = 20;
tdep->num_word_regs = 16;
tdep->num_dword_regs = 16;
/* Avoid wiring in the MMX registers for now. */
gdb_suppress_tests
}
-set nr_regs 14
set byte_regs(1) al
set byte_regs(2) bl
set byte_regs(3) cl
set byte_regs(12) r13l
set byte_regs(13) r14l
set byte_regs(14) r15l
+set byte_regs(15) ah
+set byte_regs(16) bh
+set byte_regs(17) ch
+set byte_regs(18) dh
gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
"Breakpoint .* at .*${srcfile}.*" \
"check contents of %$byte_regs($r)"
}
+for { set r 1 } { $r <= 4 } { incr r } {
+ set h [expr $r + 14]
+ gdb_test "print/x \$$byte_regs($h)" \
+ ".. = 0x[format %x $r]2" \
+ "check contents of %$byte_regs($h)"
+}
+
gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
"Breakpoint .* at .*${srcfile}.*" \
"set second breakpoint in main"
gdb_continue_to_breakpoint "continue to second breakpoint in main"
-for { set r 7 } { $r <= $nr_regs } { incr r } {
+for { set r 7 } { $r <= 14 } { incr r } {
gdb_test "print/x \$$byte_regs($r)" \
".. = 0x[format %x $r]1" \
"check contents of %$byte_regs($r)"
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
}
+for { set r 1 } { $r <= 4 } { incr r } {
+ set h [expr $r + 14]
+ gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+}
+
gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
"Breakpoint .* at .*${srcfile}.*" \
"set third breakpoint in main"
"check contents of %$byte_regs($r)"
}
-for { set r 7 } { $r <= $nr_regs } { incr r } {
+for { set r 1 } { $r <= 4 } { incr r } {
+ set h [expr $r + 14]
+ gdb_test "print \$$byte_regs($h)" \
+ ".. = $h" \
+ "check contents of %$byte_regs($h)"
+}
+
+for { set r 7 } { $r <= 14 } { incr r } {
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
}
"set forth breakpoint in main"
gdb_continue_to_breakpoint "continue to forth breakpoint in main"
-for { set r 7 } { $r <= $nr_regs } { incr r } {
+for { set r 7 } { $r <= 14 } { incr r } {
gdb_test "print \$$byte_regs($r)" \
".. = $r" \
"check contents of %$byte_regs($r)"