You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "inferior.h"
#include "wait.h"
-#include <string.h>
+#include "gdb_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
record. I call this download a "frame". Srec_frame says how many
bytes will be represented in each frame. */
-static int srec_frame = 160;
+#define SREC_SIZE 160
+static int srec_frame = SREC_SIZE;
/* This variable determines how many bytes will be represented in each
S3 s-record. */
s = abfd->sections;
while (s != (asection *) NULL)
{
+ srec_frame = SREC_SIZE;
if (s->flags & SEC_LOAD)
{
int i;
void
bug_resume (pid, step, sig)
- int pid, step, sig;
+ int pid, step;
+ enum target_signal sig;
{
dcache_flush (gr_get_dcache());
static char *wait_strings[] = {
"At Breakpoint",
"Exception: Data Access Fault (Local Bus Timeout)",
- "\r8???-Bug>",
+ "\r8??\?-Bug>", /* The '\?' avoids creating a trigraph */
"\r197-Bug>",
NULL,
};
int
bug_wait (pid, status)
int pid;
- WAITTYPE *status;
+ struct target_waitstatus *status;
{
int old_timeout = sr_get_timeout();
int old_immediate_quit = immediate_quit;
- WSETEXIT ((*status), 0);
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = 0;
/* read off leftovers from resume so that the rest can be passed
back out as stdout. */
switch (gr_multi_scan(wait_strings, need_artificial_trap == 0))
{
case 0: /* breakpoint case */
- WSETSTOP ((*status), SIGTRAP);
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_TRAP;
/* user output from the target can be discarded here. (?) */
gr_expect_prompt();
break;
case 1: /* bus error */
- WSETSTOP ((*status), SIGBUS);
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_BUS;
/* user output from the target can be discarded here. (?) */
gr_expect_prompt();
break;
if (need_artificial_trap != 0)
{
/* stepping */
- WSETSTOP ((*status), SIGTRAP);
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_TRAP;
need_artificial_trap--;
break;
}
else
{
/* exit case */
- WSETEXIT ((*status), 0);
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = 0;
break;
}
bug_fetch_register(regno)
int regno;
{
- REGISTER_TYPE regval;
-
sr_check_open();
if (regno == -1)
}
else if (regno < XFP_REGNUM)
{
- sr_write("rs ", 3);
- sr_write_cr(get_reg_name(regno));
- sr_expect("=");
- regval = sr_get_hex_word();
- gr_expect_prompt();
- supply_register(regno, (char *) ®val);
+ char buffer[MAX_REGISTER_RAW_SIZE];
+
+ sr_write ("rs ", 3);
+ sr_write_cr (get_reg_name(regno));
+ sr_expect ("=");
+ store_unsigned_integer (buffer, REGISTER_RAW_SIZE (regno),
+ sr_get_hex_word());
+ gr_expect_prompt ();
+ supply_register (regno, buffer);
}
else
{
/* 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;
struct target_ops bug_ops =
{
"bug", "Remote BUG monitor",
- "Use the mvme187 board running the BUG monitor connected\n\
-by a serial line.",
+ "Use the mvme187 board running the BUG monitor connected by a serial line.",
bug_open, gr_close,
0, gr_detach, bug_resume, bug_wait, /* attach */
&setlist),
&showlist);
+#if 0
+ /* This needs to set SREC_SIZE, not srec_frame which gets changed at the
+ end of a download. But do we need the option at all? */
add_show_from_set
(add_set_cmd ("srec-frame", class_support, var_uinteger,
(char *) &srec_frame,
This affects the communication protocol with the remote target.",
&setlist),
&showlist);
+#endif /* 0 */
add_show_from_set
(add_set_cmd ("srec-noise", class_support, var_zinteger,