This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] h8300-gdb, debug long long
- From: Michael Snyder <msnyder at redhat dot com>
- To: gdb-patches at sources dot redhat dot com, kazu at cs dot umass dot edu, dvenkat at noida dot hcltech dot com
- Date: Tue, 22 Jul 2003 18:27:52 -0700
- Subject: [PATCH] h8300-gdb, debug long long
Also signed char...
2003-07-22 Michael Snyder <msnyder@redhat.com>
* h8300-tdep.c (h8300_extract_return_value): Teach it how to
handle 8-bit returns (long long).
(h8300h_extract_return_value): Ditto.
(h8300_gdbarch_init): Long long is 8 bytes, char is unsigned.
Index: h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.75
diff -p -r1.75 h8300-tdep.c
*** h8300-tdep.c 19 Jun 2003 03:18:49 -0000 1.75
--- h8300-tdep.c 23 Jul 2003 01:24:36 -0000
*************** h8300_extract_return_value (struct type
*** 771,777 ****
void *valbuf)
{
int len = TYPE_LENGTH (type);
! ULONGEST c;
switch (len)
{
--- 771,777 ----
void *valbuf)
{
int len = TYPE_LENGTH (type);
! ULONGEST c, addr;
switch (len)
{
*************** h8300_extract_return_value (struct type
*** 786,794 ****
regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c);
store_unsigned_integer ((void*)((char *)valbuf + 2), 2, c);
break;
! case 8: /* long long, double and long double are all defined
! as 4 byte types so far so this shouldn't happen. */
! error ("I don't know how a 8 byte value is returned.");
break;
}
}
--- 786,802 ----
regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c);
store_unsigned_integer ((void*)((char *)valbuf + 2), 2, c);
break;
! case 8: /* long long is now 8 bytes. */
! if (TYPE_CODE (type) == TYPE_CODE_INT)
! {
! regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
! c = read_memory_unsigned_integer ((CORE_ADDR) addr, len);
! store_unsigned_integer (valbuf, len, c);
! }
! else
! {
! error ("I don't know how this 8 byte value is returned.");
! }
break;
}
}
*************** h8300h_extract_return_value (struct type
*** 798,804 ****
void *valbuf)
{
int len = TYPE_LENGTH (type);
! ULONGEST c;
switch (len)
{
--- 806,812 ----
void *valbuf)
{
int len = TYPE_LENGTH (type);
! ULONGEST c, addr;
switch (len)
{
*************** h8300h_extract_return_value (struct type
*** 808,816 ****
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, len, c);
break;
! case 8: /* long long, double and long double are all defined
! as 4 byte types so far so this shouldn't happen. */
! error ("I don't know how a 8 byte value is returned.");
break;
}
}
--- 816,832 ----
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, len, c);
break;
! case 8: /* long long is now 8 bytes. */
! if (TYPE_CODE (type) == TYPE_CODE_INT)
! {
! regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
! c = read_memory_unsigned_integer ((CORE_ADDR) addr, len);
! store_unsigned_integer (valbuf, len, c);
! }
! else
! {
! error ("I don't know how this 8 byte value is returned.");
! }
break;
}
}
*************** h8300_store_return_value (struct type *t
*** 830,848 ****
switch (len)
{
case 1:
! case 2:
val = extract_unsigned_integer (valbuf, len);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
! case 4: /* long, float */
val = extract_unsigned_integer (valbuf, len);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 16) &0xffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff);
break;
! case 8: /* long long, double and long double are all defined
! as 4 byte types so far so this shouldn't happen. */
! error ("I don't know how to return a 8 byte value.");
break;
}
}
--- 846,864 ----
switch (len)
{
case 1:
! case 2: /* short... */
val = extract_unsigned_integer (valbuf, len);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
! case 4: /* long, float */
val = extract_unsigned_integer (valbuf, len);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 16) &0xffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff);
break;
! case 8: /* long long, double and long double are all defined
! as 4 byte types so far so this shouldn't happen. */
! error ("I don't know how to return an 8 byte value.");
break;
}
}
*************** h8300h_store_return_value (struct type *
*** 858,870 ****
{
case 1:
case 2:
! case 4: /* long, float */
val = extract_unsigned_integer (valbuf, len);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
! case 8: /* long long, double and long double are all defined
! as 4 byte types so far so this shouldn't happen. */
! error ("I don't know how to return a 8 byte value.");
break;
}
}
--- 874,886 ----
{
case 1:
case 2:
! case 4: /* long, float */
val = extract_unsigned_integer (valbuf, len);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
! case 8: /* long long, double and long double are all defined
! as 4 byte types so far so this shouldn't happen. */
! error ("I don't know how to return an 8 byte value.");
break;
}
}
*************** h8300_gdbarch_init (struct gdbarch_info
*** 1310,1321 ****
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
! set_gdbarch_long_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
/* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
return gdbarch;
}
--- 1326,1340 ----
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
! set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
/* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+
+ /* Char is unsigned. */
+ set_gdbarch_char_signed (gdbarch, 0);
return gdbarch;
}