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 "value.h"
-#include <string.h>
+#include "gdb_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include "terminal.h"
-#include "target.h"
#include "gdbcore.h"
-#include "serial.h"
#include "gdbcmd.h"
#include "remote-utils.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;
sr_write_cr("rs cr06");
sr_expect("rs cr06");
- switch (sr_multi_scan(cpu_check_strings, 0))
+ switch (gr_multi_scan(cpu_check_strings, 0))
{
case 0: /* this is an m88100 */
target_is_m88110 = 0;
void
bug_resume (pid, step, sig)
- int pid, step, sig;
+ int pid, step;
+ enum target_signal sig;
{
dcache_flush (gr_get_dcache());
};
int
-bug_wait (status)
- WAITTYPE *status;
+bug_wait (pid, status)
+ int pid;
+ 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)
for (i = 0; i < NUM_REGS; ++i)
bug_fetch_register(i);
}
+ else if (target_is_m88110 && regno == SFIP_REGNUM)
+ {
+ /* m88110 has no sfip. */
+ long l = 0;
+ supply_register(regno, (char *) &l);
+ }
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();
-
- /* the following registers contain flag bits in the lower to bit slots.
- Mask them off */
- if (regno == PC_REGNUM /* aka sxip */
- || regno == NPC_REGNUM /* aka snip */
- || regno == SFIP_REGNUM) /* aka sfip */
- regval &= ~0x3;
+ char buffer[MAX_REGISTER_RAW_SIZE];
- supply_register(regno, (char *) ®val);
+ 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;
regname = get_reg_name(regno);
- if (regno < XFP_REGNUM)
+ if (target_is_m88110 && regno == SFIP_REGNUM)
+ return;
+ else if (regno < XFP_REGNUM)
sprintf(buffer, "rs %s %08x",
regname,
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_%2x%1x_%1x%2x%2x%2x%2x%2x%2x",
+ 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,