Thu Jan 27 15:12:23 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * main.c (baud_rate): Add FIXME comment about printing -1 value.
+
+ * remote-utils.c (usage): Fix message to be accurate and conform
+ more closely to normal conventions.
+
+ * remote-utils.c (gr_files_info): Have the exec_bfd test control
+ whether to show information about exec_bfd, and not control whether
+ to show information about device and speed.
+
+ * remote-utils.c (gr_open): If sr_get_device returns NULL, give
+ usage message, don't dump core.
+
+ * remote-bug.c (bug_write_memory): Use alloca, not GCC extension
+ for variable size array.
+ (bug_fetch_register, bug_store_register): Rename "value" to
+ "fpreg_buf" because some compilers don't like variables whose
+ names are the same as types.
+ (bug_store_register): Use a cast when converting char * to
+ unsigned char *.
+
* symmisc.c (maintenance_print_symbols): Don't refer to the name
of the command in error message (the text was referring to the old
name of the command).
/* Baud rate specified for talking to serial target systems. Default
is left as -1, so targets can choose their own defaults. */
+/* FIXME: This means that "show remotebaud" and gr_files_info can print -1
+ or (unsigned int)-1. This is a Bad User Interface. */
int baud_rate = -1;
{
/* Float register so we need to parse a strange data format. */
long p;
- unsigned char value[10];
+ unsigned char fpreg_buf[10];
sr_write("rs ", 3);
sr_write(get_reg_name(regno), strlen(get_reg_name(regno)));
/* sign */
p = sr_get_hex_digit(1);
- value[0] = p << 7;
+ fpreg_buf[0] = p << 7;
/* exponent */
sr_expect("_");
p = sr_get_hex_digit(1);
- value[0] += (p << 4);
- value[0] += sr_get_hex_digit(1);
+ fpreg_buf[0] += (p << 4);
+ fpreg_buf[0] += sr_get_hex_digit(1);
- value[1] = sr_get_hex_digit(1) << 4;
+ fpreg_buf[1] = sr_get_hex_digit(1) << 4;
/* fraction */
sr_expect("_");
- value[1] += sr_get_hex_digit(1);
+ fpreg_buf[1] += sr_get_hex_digit(1);
- value[2] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
- value[3] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
- value[4] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
- value[5] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
- value[6] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
- value[7] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
- value[8] = 0;
- value[9] = 0;
+ fpreg_buf[2] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+ fpreg_buf[3] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+ fpreg_buf[4] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+ fpreg_buf[5] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+ fpreg_buf[6] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+ fpreg_buf[7] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+ fpreg_buf[8] = 0;
+ fpreg_buf[9] = 0;
gr_expect_prompt();
- supply_register(regno, value);
+ supply_register(regno, fpreg_buf);
}
return;
read_register(regno));
else
{
- unsigned char *value = ®isters[REGISTER_BYTE(regno)];
+ unsigned char *fpreg_buf =
+ (unsigned char *)®isters[REGISTER_BYTE(regno)];
sprintf(buffer, "rs %s %1x_%02x%1x_%1x%02x%02x%02x%02x%02x%02x;d",
regname,
/* sign */
- (value[0] >> 7) & 0xf,
+ (fpreg_buf[0] >> 7) & 0xf,
/* exponent */
- value[0] & 0x7f,
- (value[1] >> 8) & 0xf,
+ fpreg_buf[0] & 0x7f,
+ (fpreg_buf[1] >> 8) & 0xf,
/* fraction */
- value[1] & 0xf,
- value[2],
- value[3],
- value[4],
- value[5],
- value[6],
- value[7]);
+ fpreg_buf[1] & 0xf,
+ fpreg_buf[2],
+ fpreg_buf[3],
+ fpreg_buf[4],
+ fpreg_buf[5],
+ fpreg_buf[6],
+ fpreg_buf[7]);
}
sr_write_cr(buffer);
int checksum;
int x;
int retries;
- char buffer[(srec_bytes + 8) << 1];
+ char *buffer = alloca ((srec_bytes + 8) << 1);
retries = 0;
if (junk != NULL)
fprintf_unfiltered(gdb_stderr, "Unrecognized arguments: `%s'.\n", junk);
- /* FIXME-now: service@host? */
-
- error("Usage: target %s <device <speed <debug>>>\n\
-or target %s <host> <port>\n", proto, proto);
+ error ("Usage: target %s [DEVICE [SPEED [DEBUG]]]\n\
+where DEVICE is the name of a device or HOST:PORT", proto, proto);
return;
}
if (sr_get_desc() != NULL)
gr_close (0);
+ /* If no args are specified, then we use the device specified by a
+ previous command or "set remotedevice". But if there is no
+ device, better stop now, not dump core. */
+
+ if (sr_get_device () == NULL)
+ usage (gr->ops->to_shortname, NULL);
+
sr_set_desc(SERIAL_OPEN (sr_get_device()));
if (!sr_get_desc())
perror_with_name((char *) sr_get_device());
gr_files_info (ops)
struct target_ops *ops;
{
- char *file = "nothing";
-
- if (exec_bfd)
- file = bfd_get_filename (exec_bfd);
-
- if (exec_bfd)
- {
#ifdef __GO32__
- printf_filtered ("\tAttached to DOS asynctsr\n");
+ printf_filtered ("\tAttached to DOS asynctsr\n");
#else
- printf_filtered ("\tAttached to %s at %d baud\n",
- sr_get_device(), sr_get_baud_rate());
+ printf_filtered ("\tAttached to %s at %d baud\n",
+ sr_get_device(), sr_get_baud_rate());
#endif
- }
- printf_filtered ("\tand running program %s\n", file);
+ if (exec_bfd)
+ {
+ printf_filtered ("\tand running program %s\n",
+ bfd_get_filename (exec_bfd));
+ }
printf_filtered ("\tusing the %s protocol.\n", ops->to_shortname);
}