aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-01-28 02:18:39 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-01-28 02:18:39 +0000
commit9c41f6a6804548bc0c0a00968459a452bb2a0ff4 (patch)
tree0851feda3649c9e9197e78eb66fabbcbf4e7b6b5
parent81f6013aa2448ca035e72d1b6343c87ffd488f0f (diff)
downloadgdb-9c41f6a6804548bc0c0a00968459a452bb2a0ff4.zip
gdb-9c41f6a6804548bc0c0a00968459a452bb2a0ff4.tar.gz
gdb-9c41f6a6804548bc0c0a00968459a452bb2a0ff4.tar.bz2
* 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 *.
-rw-r--r--gdb/ChangeLog20
-rw-r--r--gdb/main.c2
-rw-r--r--gdb/remote-bug.c55
-rw-r--r--gdb/remote-utils.c33
4 files changed, 67 insertions, 43 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e5a595c..739ab5e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,25 @@
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).
diff --git a/gdb/main.c b/gdb/main.c
index 0a6090e..2cdabaf 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -306,6 +306,8 @@ int linesize = 100;
/* 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;
diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c
index b523e39..1dd3b28 100644
--- a/gdb/remote-bug.c
+++ b/gdb/remote-bug.c
@@ -464,7 +464,7 @@ bug_fetch_register(regno)
{
/* 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)));
@@ -476,31 +476,31 @@ bug_fetch_register(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;
@@ -536,23 +536,24 @@ bug_store_register (regno)
read_register(regno));
else
{
- unsigned char *value = &registers[REGISTER_BYTE(regno)];
+ unsigned char *fpreg_buf =
+ (unsigned char *)&registers[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);
@@ -684,7 +685,7 @@ bug_write_memory (memaddr, myaddr, len)
int checksum;
int x;
int retries;
- char buffer[(srec_bytes + 8) << 1];
+ char *buffer = alloca ((srec_bytes + 8) << 1);
retries = 0;
diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c
index 75137e4..21acc2c 100644
--- a/gdb/remote-utils.c
+++ b/gdb/remote-utils.c
@@ -76,10 +76,8 @@ usage(proto, junk)
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;
}
@@ -167,6 +165,13 @@ gr_open(args, from_tty, gr)
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());
@@ -430,22 +435,18 @@ void
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);
}