From 6ccc741d0bf9ceea9f799333552a1c3dc98583b0 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Thu, 7 Mar 2002 15:29:53 +0000 Subject: [PATCH] * remote-rdi.c (myprint): Replace 'PTR' with 'void *'. (mywrite, mywritec, mypause, myreadc, mygets): Likewise. (_initialize_remote_rdi): Use add_set_boolean_cmd to register commands that set boolean values. (arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning. (arm_rdi_resume): Always initialize PC. (arm_rdi_open): Don't use rslt as a boolean. (arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume) (arm_rdi_fetch_registers, arm_rdi_store_registers) (arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill) (arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise. --- gdb/ChangeLog | 14 +++++ gdb/remote-rdi.c | 133 +++++++++++++++++++++-------------------------- 2 files changed, 72 insertions(+), 75 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 97c04032f3e..f811bb93538 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2002-03-07 Richard Earnshaw + + * remote-rdi.c (myprint): Replace 'PTR' with 'void *'. + (mywrite, mywritec, mypause, myreadc, mygets): Likewise. + (_initialize_remote_rdi): Use add_set_boolean_cmd to register + commands that set boolean values. + (arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning. + (arm_rdi_resume): Always initialize PC. + (arm_rdi_open): Don't use rslt as a boolean. + (arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume) + (arm_rdi_fetch_registers, arm_rdi_store_registers) + (arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill) + (arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise. + 2002-03-06 Alexandre Oliva * configure.in (gdb_cv_bigtoc): Check for -bbigtoc on AIX. diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c index dbf6cdfe34b..695a3026613 100644 --- a/gdb/remote-rdi.c +++ b/gdb/remote-rdi.c @@ -153,20 +153,20 @@ voiddummy (void *dummy) } static void -myprint (PTR arg, const char *format, va_list ap) +myprint (void *arg, const char *format, va_list ap) { vfprintf_unfiltered (gdb_stdout, format, ap); } static void -mywritec (PTR arg, int c) +mywritec (void *arg, int c) { if (isascii (c)) fputc_unfiltered (c, gdb_stdout); } static int -mywrite (PTR arg, char const *buffer, int len) +mywrite (void *arg, char const *buffer, int len) { int i; char *e; @@ -185,7 +185,7 @@ mywrite (PTR arg, char const *buffer, int len) } static void -mypause (PTR arg) +mypause (void *arg) { } @@ -193,13 +193,13 @@ mypause (PTR arg) being interrupted more carefully */ static int -myreadc (PTR arg) +myreadc (void *arg) { return fgetc (stdin); } static char * -mygets (PTR arg, char *buffer, int len) +mygets (void *arg, char *buffer, int len) { return fgets (buffer, len, stdin); } @@ -265,7 +265,7 @@ device is attached to the remote system (e.g. /dev/ttya)."); rslt = angel_RDI_open (10, &gdb_config, &gdb_hostif, NULL); if (rslt == RDIError_BigEndian || rslt == RDIError_LittleEndian) ; /* do nothing, this is the expected return */ - else if (rslt) + else if (rslt != RDIError_NoError) { printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt)); Adp_CloseDevice (); @@ -273,33 +273,33 @@ device is attached to the remote system (e.g. /dev/ttya)."); } rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } rslt = angel_RDI_info (RDIInfo_Points, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } rslt = angel_RDI_info (RDIInfo_Step, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } rslt = angel_RDI_info (RDIInfo_CoPro, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } rslt = angel_RDI_info (RDIInfo_SemiHosting, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } rslt = angel_RDI_info (RDIInfo_GetLoadSize, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } @@ -310,7 +310,7 @@ device is attached to the remote system (e.g. /dev/ttya)."); target_fetch_registers (-1); rslt = angel_RDI_open (1, &gdb_config, NULL, NULL); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt)); } @@ -318,14 +318,14 @@ device is attached to the remote system (e.g. /dev/ttya)."); arg1 = rom_at_zero ? 0x0 : 0x13b; rslt = angel_RDI_info (RDIVector_Catch, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } arg1 = (unsigned long) ""; rslt = angel_RDI_info (RDISet_Cmdline, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } @@ -397,7 +397,7 @@ arm_rdi_create_inferior (char *exec_file, char *args, char **env) top_of_memory); rslt = angel_RDI_info (RDIInfo_SetTopMem, &top_of_memory, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } @@ -408,7 +408,7 @@ arm_rdi_create_inferior (char *exec_file, char *args, char **env) arg1 = (unsigned long) arg_buf; rslt = angel_RDI_info (RDISet_Cmdline, /* &arg1 */ (unsigned long *) arg_buf, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } @@ -437,7 +437,7 @@ arm_rdi_close (int quitting) if (!closed_already) { rslt = angel_RDI_close (); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt)); } @@ -459,15 +459,13 @@ arm_rdi_resume (ptid_t ptid, int step, enum target_signal siggnal) if (0 /* turn on when hardware supports single-stepping */ ) { rslt = angel_RDI_step (1, &point); - if (rslt) - { - printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt)); - } + if (rslt != RDIError_NoError) + printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt)); } else { char handle[4]; - CORE_ADDR pc; + CORE_ADDR pc = 0; if (step) { @@ -475,17 +473,13 @@ arm_rdi_resume (ptid_t ptid, int step, enum target_signal siggnal) pc = arm_get_next_pc (pc); arm_rdi_insert_breakpoint (pc, handle); } + execute_status = rslt = angel_RDI_execute (&point); - if (rslt == RDIError_BreakpointReached) - ; - else if (rslt) - { - printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt)); - } + if (rslt != RDIError_NoError && rslt != RDIError_BreakpointReached) + printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt)); + if (step) - { - arm_rdi_remove_breakpoint (pc, handle); - } + arm_rdi_remove_breakpoint (pc, handle); } } @@ -541,7 +535,7 @@ arm_rdi_fetch_registers (int regno) if (regno == -1) { rslt = angel_RDI_CPUread (255, 0x27fff, rawregs); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt)); } @@ -571,7 +565,7 @@ arm_rdi_fetch_registers (int regno) rdi_regmask = 1 << regno; rslt = angel_RDI_CPUread (255, rdi_regmask, &rawreg); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt)); } @@ -618,7 +612,7 @@ arm_rdi_store_registers (int regno) rdi_regmask = 1 << regno; rslt = angel_RDI_CPUwrite (255, rdi_regmask, rawerreg); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_CPUwrite: %s\n", rdi_error_message (rslt)); } @@ -641,7 +635,7 @@ arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, if (should_write) { rslt = angel_RDI_write (myaddr, memaddr, &len); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt)); } @@ -649,7 +643,7 @@ arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, else { rslt = angel_RDI_read (memaddr, myaddr, &len); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_read: %s\n", rdi_error_message (rslt)); len = 0; @@ -668,7 +662,7 @@ arm_rdi_files_info (struct target_ops *ignore) unsigned long arg1, arg2; rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } @@ -680,14 +674,14 @@ arm_rdi_files_info (struct target_ops *ignore) printf_filtered ("Target is real hardware.\n"); rslt = angel_RDI_info (RDIInfo_Step, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } printf_filtered ("Target can%s single-step.\n", (arg1 & 0x4 ? "" : "not")); rslt = angel_RDI_info (RDIInfo_Icebreaker, &arg1, &arg2); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt)); } @@ -701,7 +695,7 @@ arm_rdi_kill (void) int rslt; rslt = angel_RDI_open (1, &gdb_config, NULL, NULL); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt)); } @@ -736,7 +730,7 @@ arm_rdi_insert_breakpoint (CORE_ADDR addr, char *contents_cache) if (arm_pc_is_thumb (addr) || arm_pc_is_thumb_dummy (addr)) type |= RDIPoint_16Bit; rslt = angel_RDI_setbreak (addr, type, 0, &point); - if (rslt) + if (rslt != RDIError_NoError) { printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt)); } @@ -754,36 +748,27 @@ arm_rdi_remove_breakpoint (CORE_ADDR addr, char *contents_cache) { int rslt; PointHandle point; - struct local_bp_list_entry *entry, *preventry; + struct local_bp_list_entry **entryp, *dead; - for (entry = local_bp_list; entry != NULL; entry = entry->next) - { - if (entry->addr == addr) - { - break; - } - preventry = entry; - } - if (entry) + for (entryp = &local_bp_list; *entryp != NULL; entryp = &(*entryp)->next) + if ((*entryp)->addr == addr) + break; + + if (*entryp) { - rslt = angel_RDI_clearbreak (entry->point); - if (rslt) - { - printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt)); - } + dead = *entryp; + rslt = angel_RDI_clearbreak (dead->point); + if (rslt != RDIError_NoError) + printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt)); + /* Delete the breakpoint entry locally. */ - if (entry == local_bp_list) - { - local_bp_list = entry->next; - } - else - { - preventry->next = entry->next; - } - xfree (entry); + *entryp = dead->next; + xfree (dead); } + return 0; } + static char * rdi_error_message (int err) @@ -1057,22 +1042,20 @@ Withough an argument, it will display current state.\n", &maintenancelist); add_show_from_set - (add_set_cmd ("rdiromatzero", no_class, - var_boolean, (char *) &rom_at_zero, - "Set target has ROM at addr 0.\n\ + (add_set_boolean_cmd ("rdiromatzero", no_class, &rom_at_zero, + "Set target has ROM at addr 0.\n\ A true value disables vector catching, false enables vector catching.\n\ This is evaluated at the time the 'target rdi' command is executed\n", - &setlist), + &setlist), &showlist); add_show_from_set - (add_set_cmd ("rdiheartbeat", no_class, - var_boolean, (char *) &rdi_heartbeat, - "Set enable for ADP heartbeat packets.\n\ + (add_set_boolean_cmd ("rdiheartbeat", no_class, &rdi_heartbeat, + "Set enable for ADP heartbeat packets.\n\ I don't know why you would want this. If you enable them,\n\ it will confuse ARM and EPI JTAG interface boxes as well\n\ as the Angel Monitor.\n", - &setlist), + &setlist), &showlist); } -- 2.30.2