2003-07-27 Andrew Cagney <cagney@redhat.com>

Patch from 2003-07-22 Kei Sakamoto <sakamoto.kei@renesas.com>:
	* m32r-tdep.c (m32r_memory_insert_breakpoint): Fix code style -
	operator at start and not end of line.
	(decode_prologue): Ditto.
	(m32r_frame_unwind_cache, m32r_unwind_sp, m32r_unwind_pc): Use
	frame_unwind_register_unsigned instead of
	frame_unwind_unsigned_register.
	(m32r_read_pc): Use regcache_cooked_read_unsigned instead of
	read_register.
	(m32r_push_dummy_call): Use register_size instead of
	REGISTER_RAW_SIZE.
	(m32r_frame_sniffer): Replace m32r_frame_p.
	(m32r_gdbarch_init): Call frame_unwind_append_sniffer.
	* m32r-rom.c (report_transfer_performance): Delete extern
	declaration.
	(m32r_load, m32r_upload_command): Use print_transfer_performance
	instead of report_transfer_performance.
	(_initialize_m32r_rom): Use add_setshow_cmd instead of add_set_cmd
	/ add_show_from_set.
This commit is contained in:
Andrew Cagney 2003-07-27 15:38:16 +00:00
parent 7e7d57681b
commit 7e3dd49eac
4 changed files with 73 additions and 51 deletions

View file

@ -1,3 +1,25 @@
2003-07-27 Andrew Cagney <cagney@redhat.com>
Patch from 2003-07-22 Kei Sakamoto <sakamoto.kei@renesas.com>:
* m32r-tdep.c (m32r_memory_insert_breakpoint): Fix code style -
operator at start and not end of line.
(decode_prologue): Ditto.
(m32r_frame_unwind_cache, m32r_unwind_sp, m32r_unwind_pc): Use
frame_unwind_register_unsigned instead of
frame_unwind_unsigned_register.
(m32r_read_pc): Use regcache_cooked_read_unsigned instead of
read_register.
(m32r_push_dummy_call): Use register_size instead of
REGISTER_RAW_SIZE.
(m32r_frame_sniffer): Replace m32r_frame_p.
(m32r_gdbarch_init): Call frame_unwind_append_sniffer.
* m32r-rom.c (report_transfer_performance): Delete extern
declaration.
(m32r_load, m32r_upload_command): Use print_transfer_performance
instead of report_transfer_performance.
(_initialize_m32r_rom): Use add_setshow_cmd instead of add_set_cmd
/ add_show_from_set.
2003-07-26 Andrew Cagney <cagney@redhat.com> 2003-07-26 Andrew Cagney <cagney@redhat.com>
* m68hc11-tdep.c (m68hc11_gdbarch_init): Set non-deprecated * m68hc11-tdep.c (m68hc11_gdbarch_init): Set non-deprecated

View file

@ -114,7 +114,7 @@ ia64-*-linux*) gdb_target=linux
;; ;;
ia64*-*-*) gdb_target=ia64 ;; ia64*-*-*) gdb_target=ia64 ;;
# OBSOLETE m32r-*-elf*) gdb_target=m32r ;; m32r-*-*) gdb_target=m32r ;;
m68hc11*-*-*|m6811*-*-*) gdb_target=m68hc11 ;; m68hc11*-*-*|m6811*-*-*) gdb_target=m68hc11 ;;
@ -265,6 +265,7 @@ esac
case "${gdb_target}" in case "${gdb_target}" in
d10v) gdb_multi_arch=yes ;; d10v) gdb_multi_arch=yes ;;
m32r) gdb_multi_arch=yes ;;
fbsd64) gdb_multi_arch=yes ;; fbsd64) gdb_multi_arch=yes ;;
m68hc11) gdb_multi_arch=yes ;; m68hc11) gdb_multi_arch=yes ;;
mn10300) gdb_multi_arch=yes ;; mn10300) gdb_multi_arch=yes ;;

View file

@ -40,8 +40,6 @@
#include <ctype.h> #include <ctype.h>
#include "regcache.h" #include "regcache.h"
extern void report_transfer_performance (unsigned long, time_t, time_t);
/* /*
* All this stuff just to get my host computer's IP address! * All this stuff just to get my host computer's IP address!
*/ */
@ -165,7 +163,8 @@ m32r_load (char *filename, int from_tty)
#endif #endif
end_time = time (NULL); end_time = time (NULL);
printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd)); printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
report_transfer_performance (data_count, start_time, end_time); print_transfer_performance (gdb_stdout, data_count, 0,
end_time - start_time);
/* Finally, make the PC point at the start address */ /* Finally, make the PC point at the start address */
if (exec_bfd) if (exec_bfd)
@ -264,7 +263,9 @@ m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
if (regno == SPI_REGNUM || regno == SPU_REGNUM) if (regno == SPI_REGNUM || regno == SPU_REGNUM)
{ /* special handling for stack pointer (spu or spi) */ { /* special handling for stack pointer (spu or spi) */
unsigned long stackmode = read_register (PSW_REGNUM) & 0x80; ULONGEST stackmode, psw;
regcache_cooked_read_unsigned (current_regcache, PSW_REGNUM, &psw);
stackmode = psw & 0x80;
if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */ if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
monitor_supply_register (SP_REGNUM, val); monitor_supply_register (SP_REGNUM, val);
@ -568,8 +569,9 @@ m32r_upload_command (char *args, int from_tty)
} }
/* Finally, make the PC point at the start address */ /* Finally, make the PC point at the start address */
write_pc (bfd_get_start_address (abfd)); write_pc (bfd_get_start_address (abfd));
report_transfer_performance (data_count, start_time, end_time);
printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd)); printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
print_transfer_performance (gdb_stdout, data_count, 0,
end_time - start_time);
} }
inferior_ptid = null_ptid; /* No process now */ inferior_ptid = null_ptid; /* No process now */
@ -610,23 +612,23 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
mon2000_ops.to_open = mon2000_open; mon2000_ops.to_open = mon2000_open;
add_target (&mon2000_ops); add_target (&mon2000_ops);
add_show_from_set add_setshow_cmd ("download-path", class_obscure,
(add_set_cmd ("download-path", class_obscure, var_string, var_string, &download_path,
(char *) &download_path, "Set the default path for downloadable SREC files.",
"Set the default path for downloadable SREC files.", "Show the default path for downloadable SREC files.",
&setlist), &showlist); NULL, NULL, &setlist, &showlist);
add_show_from_set add_setshow_cmd ("board-address", class_obscure,
(add_set_cmd ("board-address", class_obscure, var_string, var_string, &board_addr,
(char *) &board_addr, "Set IP address for M32R-EVA target board.",
"Set IP address for M32R-EVA target board.", "Show IP address for M32R-EVA target board.",
&setlist), &showlist); NULL, NULL, &setlist, &showlist);
add_show_from_set add_setshow_cmd ("server-address", class_obscure,
(add_set_cmd ("server-address", class_obscure, var_string, var_string, &server_addr,
(char *) &server_addr, "Set IP address for download server (GDB's host computer).",
"Set IP address for download server (GDB's host computer).", "Show IP address for download server (GDB's host computer).",
&setlist), &showlist); NULL, NULL, &setlist, &showlist);
add_com ("upload", class_obscure, m32r_upload_command, add_com ("upload", class_obscure, m32r_upload_command,
"Upload the srec file via the monitor's Ethernet upload capability."); "Upload the srec file via the monitor's Ethernet upload capability.");

View file

@ -111,8 +111,8 @@ m32r_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
/* Determine appropriate breakpoint contents and size for this address. */ /* Determine appropriate breakpoint contents and size for this address. */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{ {
if (((addr & 3) == 0) && if (((addr & 3) == 0)
((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80))) && ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))
{ {
static unsigned char insn[] = M32R_BE_BREAKPOINT32; static unsigned char insn[] = M32R_BE_BREAKPOINT32;
bp = insn; bp = insn;
@ -127,8 +127,8 @@ m32r_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
} }
else else
{ /* little-endian */ { /* little-endian */
if (((addr & 3) == 0) && if (((addr & 3) == 0)
((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80))) && ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))
{ {
static unsigned char insn[] = M32R_LE_BREAKPOINT32; static unsigned char insn[] = M32R_LE_BREAKPOINT32;
bp = insn; bp = insn;
@ -156,8 +156,8 @@ m32r_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
/* Determine appropriate breakpoint contents and size for this address. */ /* Determine appropriate breakpoint contents and size for this address. */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{ {
if (((addr & 3) == 0) && if (((addr & 3) == 0)
((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80))) && ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))
{ {
static unsigned char insn[] = M32R_BE_BREAKPOINT32; static unsigned char insn[] = M32R_BE_BREAKPOINT32;
bplen = sizeof (insn); bplen = sizeof (insn);
@ -171,8 +171,8 @@ m32r_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
else else
{ {
/* little-endian */ /* little-endian */
if (((addr & 3) == 0) && if (((addr & 3) == 0)
((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80))) && ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))
{ {
static unsigned char insn[] = M32R_BE_BREAKPOINT32; static unsigned char insn[] = M32R_BE_BREAKPOINT32;
bplen = sizeof (insn); bplen = sizeof (insn);
@ -362,9 +362,9 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
} }
else else
{ {
if (((insn >> 8) == 0xe4) && /* ld24 r4, xxxxxx; sub sp, r4 */ if (((insn >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
read_memory_unsigned_integer (current_pc + 2, && read_memory_unsigned_integer (current_pc + 2,
2) == 0x0f24) 2) == 0x0f24)
/* subtract 24 bit sign-extended negative-offset */ /* subtract 24 bit sign-extended negative-offset */
{ {
insn = read_memory_unsigned_integer (current_pc - 2, 4); insn = read_memory_unsigned_integer (current_pc - 2, 4);
@ -564,9 +564,9 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
short n = op & 0xffff; short n = op & 0xffff;
info->sp_offset += n; info->sp_offset += n;
} }
else if (((op >> 8) == 0xe4) && /* ld24 r4, xxxxxx; sub sp, r4 */ else if (((op >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
get_frame_memory_unsigned (next_frame, pc + 4, && get_frame_memory_unsigned (next_frame, pc + 4,
2) == 0x0f24) 2) == 0x0f24)
{ {
unsigned long n = op & 0xffffff; unsigned long n = op & 0xffffff;
info->sp_offset += n; info->sp_offset += n;
@ -617,7 +617,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
/* The SP was moved to the FP. This indicates that a new frame /* The SP was moved to the FP. This indicates that a new frame
was created. Get THIS frame's FP value by unwinding it from was created. Get THIS frame's FP value by unwinding it from
the next frame. */ the next frame. */
frame_unwind_unsigned_register (next_frame, M32R_FP_REGNUM, &this_base); this_base = frame_unwind_register_unsigned (next_frame, M32R_FP_REGNUM);
/* The FP points at the last saved register. Adjust the FP back /* The FP points at the last saved register. Adjust the FP back
to before the first saved register giving the SP. */ to before the first saved register giving the SP. */
prev_sp = this_base + info->size; prev_sp = this_base + info->size;
@ -626,7 +626,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
{ {
/* Assume that the FP is this frame's SP but with that pushed /* Assume that the FP is this frame's SP but with that pushed
stack space added back. */ stack space added back. */
frame_unwind_unsigned_register (next_frame, M32R_SP_REGNUM, &this_base); this_base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
prev_sp = this_base + info->size; prev_sp = this_base + info->size;
} }
@ -657,11 +657,11 @@ static CORE_ADDR
m32r_read_pc (ptid_t ptid) m32r_read_pc (ptid_t ptid)
{ {
ptid_t save_ptid; ptid_t save_ptid;
CORE_ADDR pc; ULONGEST pc;
save_ptid = inferior_ptid; save_ptid = inferior_ptid;
inferior_ptid = ptid; inferior_ptid = ptid;
pc = (int) read_register (M32R_PC_REGNUM); regcache_cooked_read_unsigned (current_regcache, M32R_PC_REGNUM, &pc);
inferior_ptid = save_ptid; inferior_ptid = save_ptid;
return pc; return pc;
} }
@ -680,9 +680,7 @@ m32r_write_pc (CORE_ADDR val, ptid_t ptid)
static CORE_ADDR static CORE_ADDR
m32r_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) m32r_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
{ {
ULONGEST sp; return frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
frame_unwind_unsigned_register (next_frame, M32R_SP_REGNUM, &sp);
return sp;
} }
@ -744,7 +742,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
else if (len < 4) else if (len < 4)
{ {
/* value gets right-justified in the register or stack word */ /* value gets right-justified in the register or stack word */
memcpy (valbuf + (REGISTER_RAW_SIZE (argreg) - len), memcpy (valbuf + (register_size (gdbarch, argreg) - len),
(char *) VALUE_CONTENTS (args[argnum]), len); (char *) VALUE_CONTENTS (args[argnum]), len);
val = valbuf; val = valbuf;
} }
@ -763,15 +761,16 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
{ {
/* there's room in a register */ /* there's room in a register */
regval = regval =
extract_unsigned_integer (val, REGISTER_RAW_SIZE (argreg)); extract_unsigned_integer (val,
register_size (gdbarch, argreg));
regcache_cooked_write_unsigned (regcache, argreg++, regval); regcache_cooked_write_unsigned (regcache, argreg++, regval);
} }
/* Store the value 4 bytes at a time. This means that things /* Store the value 4 bytes at a time. This means that things
larger than 4 bytes may go partly in registers and partly larger than 4 bytes may go partly in registers and partly
on the stack. */ on the stack. */
len -= REGISTER_RAW_SIZE (argreg); len -= register_size (gdbarch, argreg);
val += REGISTER_RAW_SIZE (argreg); val += register_size (gdbarch, argreg);
} }
} }
@ -811,9 +810,7 @@ m32r_extract_return_value (struct type *type, struct regcache *regcache,
static CORE_ADDR static CORE_ADDR
m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{ {
ULONGEST pc; return frame_unwind_register_unsigned (next_frame, M32R_PC_REGNUM);
frame_unwind_unsigned_register (next_frame, M32R_PC_REGNUM, &pc);
return pc;
} }
/* Given a GDB frame, determine the address of the calling function's /* Given a GDB frame, determine the address of the calling function's
@ -884,7 +881,7 @@ static const struct frame_unwind m32r_frame_unwind = {
}; };
static const struct frame_unwind * static const struct frame_unwind *
m32r_frame_p (CORE_ADDR pc) m32r_frame_sniffer (struct frame_info *next_frame)
{ {
return &m32r_frame_unwind; return &m32r_frame_unwind;
} }
@ -966,7 +963,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_align (gdbarch, m32r_frame_align); set_gdbarch_frame_align (gdbarch, m32r_frame_align);
frame_unwind_append_predicate (gdbarch, m32r_frame_p); frame_unwind_append_sniffer (gdbarch, m32r_frame_sniffer);
frame_base_set_default (gdbarch, &m32r_frame_base); frame_base_set_default (gdbarch, &m32r_frame_base);
/* Methods for saving / extracting a dummy frame's ID. The ID's /* Methods for saving / extracting a dummy frame's ID. The ID's