Changes to support GDB running on DOS using GO32 and H8 support
* defs.h: if xm.h doesn't define FOPEN_RB, include "fopen-same.h", allowing hosts with different text and binary file formats to work. * coffread.c (read_coff_symtab): changed calling convention and operation - now it opens its own file with FOPEN_RB rather than duping and fdopening the provided handle. * dbxread.c, cplus-dem.c: #include mangling. * exec.c: If O_BINARY isn't defined, set it to 0, call openp for binary files oring in the right bit. * utils.c, terminal.h, inflow.c: hackery because dos doesn't have terminals. * remote-hms.c: cleanup to use the new remote serial stuff * serial.h, ser-termios.c, ser-go32.c: newfiles to provide host independent remote terminal I/O. * remote.c: if DONT_USE_REMOTE is defined, then don't use it. * source.c (openp): fix off by one problem removing / - can now open a source file in the root directory with DOS. * values.c (value_as_pointer): remove bogus address bits from long. (unpack_long): unpack into unsigned long/short if pointer.
This commit is contained in:
parent
bbbd93b8e9
commit
ae0ea72ee2
12 changed files with 861 additions and 405 deletions
|
@ -90,6 +90,7 @@ gdbcmd.h
|
||||||
gdbcore.h
|
gdbcore.h
|
||||||
gdbtypes.c
|
gdbtypes.c
|
||||||
gdbtypes.h
|
gdbtypes.h
|
||||||
|
go32-xdep.c
|
||||||
gould-pinsn.c
|
gould-pinsn.c
|
||||||
gould-xdep.c
|
gould-xdep.c
|
||||||
h8300-tdep.c
|
h8300-tdep.c
|
||||||
|
@ -171,6 +172,9 @@ sparc-xdep.c
|
||||||
stack.c
|
stack.c
|
||||||
standalone.c
|
standalone.c
|
||||||
stuff.c
|
stuff.c
|
||||||
|
serial.h
|
||||||
|
ser-termios.c
|
||||||
|
ser-go32.c
|
||||||
sun3-xdep.c
|
sun3-xdep.c
|
||||||
sun386-xdep.c
|
sun386-xdep.c
|
||||||
symfile.c
|
symfile.c
|
||||||
|
@ -246,7 +250,6 @@ xcoffread.c
|
||||||
xcoffsolib.c
|
xcoffsolib.c
|
||||||
xcoffsolib.h
|
xcoffsolib.h
|
||||||
xm-3b1.h
|
xm-3b1.h
|
||||||
xm-m88k.h
|
|
||||||
xm-altos.h
|
xm-altos.h
|
||||||
xm-amix.h
|
xm-amix.h
|
||||||
xm-apollo68v.h
|
xm-apollo68v.h
|
||||||
|
@ -254,6 +257,7 @@ xm-arm.h
|
||||||
xm-bigmips.h
|
xm-bigmips.h
|
||||||
xm-convex.h
|
xm-convex.h
|
||||||
xm-delta88.h
|
xm-delta88.h
|
||||||
|
xm-go32.h
|
||||||
xm-hp300bsd.h
|
xm-hp300bsd.h
|
||||||
xm-hp300hpux.h
|
xm-hp300hpux.h
|
||||||
xm-i386mach.h
|
xm-i386mach.h
|
||||||
|
@ -265,6 +269,7 @@ xm-irix3.h
|
||||||
xm-irix4.h
|
xm-irix4.h
|
||||||
xm-isi.h
|
xm-isi.h
|
||||||
xm-m68k.h
|
xm-m68k.h
|
||||||
|
xm-m88k.h
|
||||||
xm-merlin.h
|
xm-merlin.h
|
||||||
xm-mips.h
|
xm-mips.h
|
||||||
xm-news.h
|
xm-news.h
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
Tue May 12 17:44:39 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||||
|
Changes to support GDB running on DOS using GO32 and H8 support
|
||||||
|
|
||||||
|
* defs.h: if xm.h doesn't define FOPEN_RB, include "fopen-same.h",
|
||||||
|
allowing hosts with different text and binary file formats to
|
||||||
|
work.
|
||||||
|
* coffread.c (read_coff_symtab): changed calling convention and
|
||||||
|
operation - now it opens its own file with FOPEN_RB rather than
|
||||||
|
duping and fdopening the provided handle.
|
||||||
|
* dbxread.c, cplus-dem.c: #include mangling.
|
||||||
|
* exec.c: If O_BINARY isn't defined, set it to 0, call openp for
|
||||||
|
binary files oring in the right bit.
|
||||||
|
* utils.c, terminal.h, inflow.c: hackery because dos doesn't have terminals.
|
||||||
|
* remote-hms.c: cleanup to use the new remote serial stuff
|
||||||
|
* serial.h, ser-termios.c, ser-go32.c: newfiles to provide host
|
||||||
|
independent remote terminal I/O.
|
||||||
|
* remote.c: if DONT_USE_REMOTE not defined, then don't use it.
|
||||||
|
* source.c (openp): fix off by one problem removing / - can now
|
||||||
|
open a source file in the root directory with DOS.
|
||||||
|
* values.c (value_as_pointer): remove bogus address bits from
|
||||||
|
long. (unpack_long): unpack into unsigned long/short if pointer.
|
||||||
|
|
||||||
|
|
||||||
Tue May 12 14:15:48 1992 Stu Grossman (grossman at cygnus.com)
|
Tue May 12 14:15:48 1992 Stu Grossman (grossman at cygnus.com)
|
||||||
|
|
||||||
* infrun.c (child_attach): Don't allow gdb to attach to itself.
|
* infrun.c (child_attach): Don't allow gdb to attach to itself.
|
||||||
|
|
|
@ -102,6 +102,7 @@ i386)
|
||||||
ncr) gdb_host=ncr3000 ;;
|
ncr) gdb_host=ncr3000 ;;
|
||||||
*)
|
*)
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
|
go32) gdb_host=go32 ;;
|
||||||
sysv32) gdb_host=i386v32 ;;
|
sysv32) gdb_host=i386v32 ;;
|
||||||
sysv4*) gdb_host=i386v4 ;;
|
sysv4*) gdb_host=i386v4 ;;
|
||||||
sysv*) gdb_host=i386v ;;
|
sysv*) gdb_host=i386v ;;
|
||||||
|
|
|
@ -30,13 +30,7 @@
|
||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef USG
|
|
||||||
#include <memory.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#else
|
|
||||||
#include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined (GNU_DEMANGLING) && !defined (ARM_DEMANGLING)
|
#if !defined (GNU_DEMANGLING) && !defined (ARM_DEMANGLING)
|
||||||
# define GNU_DEMANGLING 1
|
# define GNU_DEMANGLING 1
|
||||||
|
|
43
gdb/go32-xdep.c
Normal file
43
gdb/go32-xdep.c
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/* Host-dependent code for dos running GO32 for GDB, the GNU debugger.
|
||||||
|
Copyright 1992
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static void uerror(char *s)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Fatal: %s!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fork(){uerror("attempt to call fork()");}
|
||||||
|
vfork(){uerror("attempt to call vfork()");}
|
||||||
|
wait(){uerror("attempt to call wait()");}
|
||||||
|
execlp(){uerror("attempt to call execlp()");}
|
||||||
|
kill_inferior_fast(){uerror("attempt to call kill_inferior_fast()");}
|
||||||
|
kill_inferior(){uerror("attempt to call kill_inferior()");}
|
||||||
|
re_comp(){uerror("attempt to call re_comp()");}
|
||||||
|
re_exec(){uerror("attempt to call re_exec()");}
|
||||||
|
call_ptrace(){uerror("attempt to call call_ptrace()");}
|
||||||
|
child_resume(){uerror("attempt to call child_resume()");}
|
||||||
|
fetch_inferior_registers(){uerror("attempt to call fetch_inferior_registers()");}
|
||||||
|
store_inferior_registers(){uerror("attempt to call store_inferior_registers()");}
|
||||||
|
child_xfer_memory(){uerror("attempt to call child_xfer_memory()");}
|
||||||
|
fetch_core_registers(){uerror("attempt to call fetch_core_registers()");}
|
||||||
|
|
557
gdb/remote-hms.c
557
gdb/remote-hms.c
|
@ -234,75 +234,37 @@ dcache_init ()
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
static int timeout = 2;
|
static int timeout = 2;
|
||||||
static char *dev_name = "/dev/ttya";
|
|
||||||
|
|
||||||
|
|
||||||
|
static CONST char *dev_name;
|
||||||
|
|
||||||
|
|
||||||
/* Descriptor for I/O to remote machine. Initialize it to -1 so that
|
/* Descriptor for I/O to remote machine. Initialize it to -1 so that
|
||||||
hms_open knows that we don't have a file open when the program
|
hms_open knows that we don't have a file open when the program
|
||||||
starts. */
|
starts. */
|
||||||
int hms_desc = -1;
|
|
||||||
#define OPEN(x) ((x) >= 0)
|
|
||||||
|
|
||||||
|
|
||||||
void hms_open();
|
int is_open = 0;
|
||||||
|
int check_open()
|
||||||
|
{
|
||||||
|
if (!is_open)
|
||||||
|
{
|
||||||
|
error("remote device not open");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define ON 1
|
#define ON 1
|
||||||
#define OFF 0
|
#define OFF 0
|
||||||
static void
|
|
||||||
rawmode(desc, turnon)
|
|
||||||
int desc;
|
|
||||||
int turnon;
|
|
||||||
{
|
|
||||||
TERMINAL sg;
|
|
||||||
|
|
||||||
if (desc < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ioctl (desc, TIOCGETP, &sg);
|
|
||||||
|
|
||||||
if (turnon) {
|
|
||||||
#ifdef HAVE_TERMIO
|
|
||||||
sg.c_lflag &= ~(ICANON);
|
|
||||||
#else
|
|
||||||
sg.sg_flags |= RAW;
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
#ifdef HAVE_TERMIO
|
|
||||||
sg.c_lflag |= ICANON;
|
|
||||||
#else
|
|
||||||
sg.sg_flags &= ~(RAW);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
ioctl (desc, TIOCSETP, &sg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Read a character from the remote system, doing all the fancy
|
/* Read a character from the remote system, doing all the fancy
|
||||||
timeout stuff. */
|
timeout stuff. */
|
||||||
static int
|
static int
|
||||||
readchar ()
|
readchar ()
|
||||||
{
|
{
|
||||||
char buf;
|
int ok;
|
||||||
|
int buf;
|
||||||
|
buf = serial_timedreadchar(timeout, &ok);
|
||||||
|
|
||||||
buf = '\0';
|
if (!ok)
|
||||||
#ifdef HAVE_TERMIO
|
|
||||||
/* termio does the timeout for us. */
|
|
||||||
read (hms_desc, &buf, 1);
|
|
||||||
#else
|
|
||||||
alarm (timeout);
|
|
||||||
if (read (hms_desc, &buf, 1) < 0)
|
|
||||||
{
|
|
||||||
if (errno == EINTR)
|
|
||||||
error ("Timeout reading from remote system.");
|
|
||||||
else
|
|
||||||
perror_with_name ("remote");
|
|
||||||
}
|
|
||||||
alarm (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (buf == '\0')
|
|
||||||
error ("Timeout reading from remote system.");
|
error ("Timeout reading from remote system.");
|
||||||
|
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
|
@ -314,26 +276,15 @@ readchar ()
|
||||||
static int
|
static int
|
||||||
readchar_nofail ()
|
readchar_nofail ()
|
||||||
{
|
{
|
||||||
char buf;
|
int ok;
|
||||||
|
int buf;
|
||||||
|
buf = serial_timedreadchar(timeout, &ok);
|
||||||
|
if (!ok) buf = 0;
|
||||||
|
if (!quiet)
|
||||||
|
printf("%c",buf);
|
||||||
|
|
||||||
buf = '\0';
|
|
||||||
#ifdef HAVE_TERMIO
|
|
||||||
/* termio does the timeout for us. */
|
|
||||||
read (hms_desc, &buf, 1);
|
|
||||||
#else
|
|
||||||
alarm (timeout);
|
|
||||||
if (read (hms_desc, &buf, 1) < 0)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
alarm (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (buf == '\0')
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return buf & 0x7f;
|
return buf & 0x7f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep discarding input from the remote system, until STRING is found.
|
/* Keep discarding input from the remote system, until STRING is found.
|
||||||
|
@ -379,7 +330,6 @@ expect (string)
|
||||||
static void
|
static void
|
||||||
expect_prompt ()
|
expect_prompt ()
|
||||||
{
|
{
|
||||||
|
|
||||||
expect ("HMS>");
|
expect ("HMS>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,21 +385,7 @@ get_hex_word()
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
/* Called when SIGALRM signal sent due to alarm() timeout. */
|
/* Called when SIGALRM signal sent due to alarm() timeout. */
|
||||||
#ifndef HAVE_TERMIO
|
|
||||||
|
|
||||||
#ifndef __STDC__
|
|
||||||
# ifndef volatile
|
|
||||||
# define volatile /**/
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
volatile int n_alarms;
|
|
||||||
|
|
||||||
void
|
|
||||||
hms_timer ()
|
|
||||||
{
|
|
||||||
n_alarms++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Number of SIGTRAPs we need to simulate. That is, the next
|
/* Number of SIGTRAPs we need to simulate. That is, the next
|
||||||
|
@ -466,12 +402,7 @@ int from_tty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static check_open()
|
|
||||||
{
|
|
||||||
if (!OPEN(hms_desc)) {
|
|
||||||
hms_open("",0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Download a file specified in 'args', to the hms.
|
* Download a file specified in 'args', to the hms.
|
||||||
|
@ -486,6 +417,7 @@ int fromtty;
|
||||||
int n;
|
int n;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
|
||||||
|
|
||||||
DENTER("hms_load()");
|
DENTER("hms_load()");
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
|
@ -512,9 +444,9 @@ int fromtty;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
#define DELTA 2048
|
#define DELTA 1024
|
||||||
char *buffer = xmalloc(DELTA);
|
char *buffer = xmalloc(DELTA);
|
||||||
printf_filtered("%s: %4x .. %4x ",s->name, s->vma, s->vma + s->_raw_size);
|
printf_filtered("%s\t: 0x%4x .. 0x%4x ",s->name, s->vma, s->vma + s->_raw_size);
|
||||||
for (i = 0; i < s->_raw_size; i+= DELTA)
|
for (i = 0; i < s->_raw_size; i+= DELTA)
|
||||||
{
|
{
|
||||||
int delta = DELTA;
|
int delta = DELTA;
|
||||||
|
@ -526,12 +458,14 @@ int fromtty;
|
||||||
printf_filtered("*");
|
printf_filtered("*");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
printf_filtered( "\n");
|
printf_filtered( "\n");
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
s = s->next;
|
s = s->next;
|
||||||
}
|
}
|
||||||
|
sprintf(buffer, "r PC=%x", abfd->start_address);
|
||||||
|
hms_write_cr(buffer);
|
||||||
|
expect_prompt();
|
||||||
|
|
||||||
DEXIT("hms_load()");
|
DEXIT("hms_load()");
|
||||||
}
|
}
|
||||||
|
@ -545,7 +479,7 @@ hms_create_inferior (execfile, args, env)
|
||||||
char **env;
|
char **env;
|
||||||
{
|
{
|
||||||
int entry_pt;
|
int entry_pt;
|
||||||
|
char buffer[100];
|
||||||
DENTER("hms_create_inferior()");
|
DENTER("hms_create_inferior()");
|
||||||
|
|
||||||
if (args && *args)
|
if (args && *args)
|
||||||
|
@ -557,62 +491,20 @@ hms_create_inferior (execfile, args, env)
|
||||||
entry_pt = (int) bfd_get_start_address (exec_bfd);
|
entry_pt = (int) bfd_get_start_address (exec_bfd);
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
if (OPEN(hms_desc))
|
|
||||||
{
|
|
||||||
char buffer[100];
|
|
||||||
hms_kill(NULL,NULL);
|
|
||||||
hms_clear_breakpoints();
|
|
||||||
init_wait_for_inferior ();
|
|
||||||
/* Clear the input because what the hms sends back is different
|
|
||||||
* depending on whether it was running or not.
|
|
||||||
*/
|
|
||||||
/*sprintf(buffer,"g %x", entry_pt);
|
|
||||||
|
|
||||||
hms_write_cr(buffer);
|
hms_kill(NULL,NULL);
|
||||||
*/
|
hms_clear_breakpoints();
|
||||||
hms_write_cr("");
|
init_wait_for_inferior ();
|
||||||
|
hms_write_cr("");
|
||||||
|
expect_prompt();
|
||||||
|
|
||||||
expect_prompt();
|
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
||||||
|
proceed(entry_pt, -1, 0);
|
||||||
|
|
||||||
|
|
||||||
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
|
||||||
proceed(entry_pt, -1, 0);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
DEXIT("hms_create_inferior()");
|
DEXIT("hms_create_inferior()");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate baud rates from integers to damn B_codes. Unix should
|
|
||||||
have outgrown this crap years ago, but even POSIX wouldn't buck it. */
|
|
||||||
|
|
||||||
#ifndef B19200
|
|
||||||
#define B19200 EXTA
|
|
||||||
#endif
|
|
||||||
#ifndef B38400
|
|
||||||
#define B38400 EXTB
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct {int rate, damn_b;} baudtab[] = {
|
|
||||||
{9600, B9600},
|
|
||||||
{19200, B19200},
|
|
||||||
{300, B300},
|
|
||||||
{1200, B1200},
|
|
||||||
{2400, B2400},
|
|
||||||
{4800, B4800},
|
|
||||||
{-1, -1},
|
|
||||||
};
|
|
||||||
|
|
||||||
static int damn_b (rate)
|
|
||||||
int rate;
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; baudtab[i].rate != -1; i++)
|
|
||||||
if (rate == baudtab[i].rate) return baudtab[i].damn_b;
|
|
||||||
return B19200;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Open a connection to a remote debugger.
|
/* Open a connection to a remote debugger.
|
||||||
NAME is the filename used for communication, then a space,
|
NAME is the filename used for communication, then a space,
|
||||||
|
@ -661,65 +553,46 @@ static int baudrate = 9600;
|
||||||
static int
|
static int
|
||||||
is_baudrate_right()
|
is_baudrate_right()
|
||||||
{
|
{
|
||||||
|
int ok;
|
||||||
|
|
||||||
/* Put this port into NORMAL mode, send the 'normal' character */
|
/* Put this port into NORMAL mode, send the 'normal' character */
|
||||||
|
|
||||||
hms_write("\001", 1); /* Control A */
|
hms_write("\001", 1); /* Control A */
|
||||||
hms_write("\r", 1); /* Cr */
|
hms_write("\r", 1); /* Cr */
|
||||||
|
|
||||||
while ( readchar_nofail()) /* Skip noise we put there */
|
while (1)
|
||||||
;
|
{
|
||||||
|
serial_timedreadchar(timeout, &ok);
|
||||||
|
if (!ok) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
hms_write("r",1);
|
||||||
|
|
||||||
hms_write("r");
|
|
||||||
if (readchar_nofail() == 'r')
|
if (readchar_nofail() == 'r')
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Not the right baudrate, or the board's not on */
|
/* Not the right baudrate, or the board's not on */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
set_rate()
|
set_rate()
|
||||||
{
|
{
|
||||||
TERMINAL sg;
|
if (!serial_setbaudrate(baudrate))
|
||||||
ioctl (hms_desc, TIOCGETP, &sg);
|
error("Can't set baudrate");
|
||||||
#ifdef HAVE_TERMIO
|
|
||||||
sg.c_cc[VMIN] = 0; /* read with timeout. */
|
|
||||||
sg.c_cc[VTIME] = timeout * 10;
|
|
||||||
sg.c_lflag &= ~(ICANON | ECHO);
|
|
||||||
sg.c_cflag = (sg.c_cflag & ~CBAUD) | damn_b (baudrate);
|
|
||||||
#else
|
|
||||||
sg.sg_ispeed = damn_b (baudrate);
|
|
||||||
sg.sg_ospeed = damn_b (baudrate);
|
|
||||||
sg.sg_flags |= RAW | ANYP;
|
|
||||||
sg.sg_flags &= ~ECHO;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ioctl (hms_desc, TIOCSETP, &sg);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_baudrate_right()
|
get_baudrate_right()
|
||||||
{
|
{
|
||||||
|
|
||||||
int which_rate = 0;
|
|
||||||
|
|
||||||
while (!is_baudrate_right())
|
while (!is_baudrate_right())
|
||||||
{
|
{
|
||||||
which_rate++;
|
baudrate = serial_nextbaudrate(baudrate);
|
||||||
|
if (baudrate == 0) {
|
||||||
if (baudtab[which_rate].rate == -1)
|
printf_filtered("Board not yet in sync\n");
|
||||||
{
|
break;
|
||||||
which_rate = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
baudrate = baudtab[which_rate].rate;
|
|
||||||
printf_filtered("Board not responding, trying %d baud\n",baudrate);
|
printf_filtered("Board not responding, trying %d baud\n",baudrate);
|
||||||
QUIT;
|
QUIT;
|
||||||
set_rate();
|
serial_setbaudrate(baudrate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,46 +611,32 @@ hms_open (name, from_tty)
|
||||||
name = "";
|
name = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (is_open)
|
||||||
|
hms_close (0);
|
||||||
|
if (name && strlen(name))
|
||||||
|
dev_name = strdup(name);
|
||||||
|
if (!serial_open(dev_name))
|
||||||
|
perror_with_name ((char *)dev_name);
|
||||||
|
serial_raw();
|
||||||
|
is_open = 1;
|
||||||
|
|
||||||
hms_close (0);
|
|
||||||
|
|
||||||
hms_desc = open (dev_name, O_RDWR);
|
|
||||||
if (hms_desc < 0)
|
|
||||||
perror_with_name (dev_name);
|
|
||||||
|
|
||||||
set_rate();
|
|
||||||
|
|
||||||
dcache_init();
|
dcache_init();
|
||||||
|
|
||||||
|
|
||||||
/* start_remote (); /* Initialize gdb process mechanisms */
|
/* start_remote (); /* Initialize gdb process mechanisms */
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_TERMIO
|
|
||||||
#ifndef NO_SIGINTERRUPT
|
|
||||||
/* Cause SIGALRM's to make reads fail with EINTR instead of resuming
|
|
||||||
the read. */
|
|
||||||
if (siginterrupt (SIGALRM, 1) != 0)
|
|
||||||
perror ("hms_open: error in siginterrupt");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set up read timeout timer. */
|
|
||||||
if ((void (*)) signal (SIGALRM, hms_timer) == (void (*)) -1)
|
|
||||||
perror ("hms_open: error in signal");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
get_baudrate_right();
|
get_baudrate_right();
|
||||||
|
|
||||||
/* Hello? Are you there? */
|
/* Hello? Are you there? */
|
||||||
write (hms_desc, "\r", 1);
|
serial_write("\r",1);
|
||||||
|
|
||||||
expect_prompt ();
|
expect_prompt ();
|
||||||
|
|
||||||
/* Clear any break points */
|
/* Clear any break points */
|
||||||
hms_clear_breakpoints();
|
hms_clear_breakpoints();
|
||||||
|
|
||||||
|
|
||||||
printf_filtered("Remote debugging on an H8/300 HMS via %s.\n",dev_name);
|
printf_filtered("Connected to remote H8/300 HMS system.\n");
|
||||||
|
|
||||||
DEXIT("hms_open()");
|
DEXIT("hms_open()");
|
||||||
}
|
}
|
||||||
|
@ -795,21 +654,10 @@ hms_close (quitting)
|
||||||
hms_clear_breakpoints();
|
hms_clear_breakpoints();
|
||||||
|
|
||||||
/* Put this port back into REMOTE mode */
|
/* Put this port back into REMOTE mode */
|
||||||
if (OPEN(hms_desc)) {
|
sleep(1); /* Let any output make it all the way back */
|
||||||
|
serial_write("R\r", 2);
|
||||||
sleep(1); /* Let any output make it all the way back */
|
serial_close();
|
||||||
write(hms_desc, "R\r", 2);
|
is_open = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/* Due to a bug in Unix, fclose closes not only the stdio stream,
|
|
||||||
but also the file descriptor. So we don't actually close
|
|
||||||
hms_desc. */
|
|
||||||
if (OPEN(hms_desc))
|
|
||||||
close (hms_desc);
|
|
||||||
|
|
||||||
/* Do not try to close hms_desc again, later in the program. */
|
|
||||||
|
|
||||||
hms_desc = -1;
|
|
||||||
|
|
||||||
DEXIT("hms_close()");
|
DEXIT("hms_close()");
|
||||||
}
|
}
|
||||||
|
@ -852,11 +700,9 @@ hms_detach (args,from_tty)
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
DENTER("hms_detach()");
|
DENTER("hms_detach()");
|
||||||
if (OPEN(hms_desc)) { /* Send it on its way (tell it to continue) */
|
if (is_open)
|
||||||
|
{
|
||||||
hms_clear_breakpoints();
|
hms_clear_breakpoints();
|
||||||
#if 0
|
|
||||||
fprintf(hms_stream,"G\r");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_target(); /* calls hms_close to do the real work */
|
pop_target(); /* calls hms_close to do the real work */
|
||||||
|
@ -934,7 +780,7 @@ hms_wait (status)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = 0; /* Don't time out -- user program is running. */
|
timeout = 99999; /* Don't time out -- user program is running. */
|
||||||
immediate_quit = 1; /* Helps ability to QUIT */
|
immediate_quit = 1; /* Helps ability to QUIT */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -1010,11 +856,8 @@ static char *
|
||||||
get_reg_name (regno)
|
get_reg_name (regno)
|
||||||
int regno;
|
int regno;
|
||||||
{
|
{
|
||||||
static char *rn[NUM_REGS]= REGISTER_NAMES;
|
static char *rn[NUM_REGS]= REGISTER_NAMES;
|
||||||
|
|
||||||
|
|
||||||
return rn[regno];
|
return rn[regno];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the remote registers. */
|
/* Read the remote registers. */
|
||||||
|
@ -1069,7 +912,8 @@ hms_write(a,l)
|
||||||
char *a;
|
char *a;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
write(hms_desc,a,l);
|
serial_write(a, l);
|
||||||
|
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
for (i = 0; i < l ; i++)
|
for (i = 0; i < l ; i++)
|
||||||
{
|
{
|
||||||
|
@ -1080,12 +924,13 @@ char *a;
|
||||||
hms_write_cr(s)
|
hms_write_cr(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
hms_write( s, strlen(s));
|
hms_write( s, strlen(s));
|
||||||
hms_write("\r",1);
|
hms_write("\r",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hms_fetch_registers ()
|
hms_fetch_register (dummy)
|
||||||
|
int dummy;
|
||||||
{
|
{
|
||||||
#define REGREPLY_SIZE 79
|
#define REGREPLY_SIZE 79
|
||||||
char linebuf[REGREPLY_SIZE+1];
|
char linebuf[REGREPLY_SIZE+1];
|
||||||
|
@ -1132,43 +977,30 @@ hms_fetch_registers ()
|
||||||
while (!gottok);
|
while (!gottok);
|
||||||
for (i = 0; i < NUM_REGS; i++)
|
for (i = 0; i < NUM_REGS; i++)
|
||||||
{
|
{
|
||||||
supply_register (i, reg+i);
|
char swapped[2];
|
||||||
|
swapped[1] = reg[i];
|
||||||
|
swapped[0] = (reg[i])>> 8;
|
||||||
|
|
||||||
|
supply_register (i, swapped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fetch register REGNO, or all registers if REGNO is -1.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
hms_fetch_register (regno)
|
|
||||||
int regno;
|
|
||||||
{
|
|
||||||
|
|
||||||
hms_fetch_registers ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Store the remote registers from the contents of the block REGS. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
hms_store_registers ()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < NUM_REGS; i++)
|
|
||||||
hms_store_register(i);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Store register REGNO, or all if REGNO == -1.
|
/* Store register REGNO, or all if REGNO == -1.
|
||||||
Return errno value. */
|
Return errno value. */
|
||||||
int
|
static void
|
||||||
hms_store_register (regno)
|
hms_store_register (regno)
|
||||||
int regno;
|
int regno;
|
||||||
{
|
{
|
||||||
|
|
||||||
/* printf("hms_store_register() called.\n"); fflush(stdout); /* */
|
/* printf("hms_store_register() called.\n"); fflush(stdout); /* */
|
||||||
if (regno == -1)
|
if (regno == -1)
|
||||||
hms_store_registers ();
|
{
|
||||||
|
for (regno = 0; regno < NUM_REGS; regno ++)
|
||||||
|
{
|
||||||
|
hms_store_register(regno);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *name = get_reg_name (regno);
|
char *name = get_reg_name (regno);
|
||||||
|
@ -1179,9 +1011,11 @@ hms_store_register (regno)
|
||||||
}
|
}
|
||||||
|
|
||||||
DEXIT("hms_store_registers()");
|
DEXIT("hms_store_registers()");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Get ready to modify the registers array. On machines which store
|
/* Get ready to modify the registers array. On machines which store
|
||||||
individual registers, this doesn't need to do anything. On machines
|
individual registers, this doesn't need to do anything. On machines
|
||||||
which store all the registers in one fell swoop, this makes sure
|
which store all the registers in one fell swoop, this makes sure
|
||||||
|
@ -1301,50 +1135,53 @@ hms_xfer_inferior_memory(memaddr, myaddr, len, write, target)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
int
|
|
||||||
hms_xfer_inferior_memory (memaddr, myaddr, len, write)
|
|
||||||
CORE_ADDR memaddr;
|
|
||||||
char *myaddr;
|
|
||||||
int len;
|
|
||||||
int write;
|
|
||||||
{
|
|
||||||
memaddr &= 0xffff;
|
|
||||||
if (write)
|
|
||||||
return hms_write_inferior_memory (memaddr, myaddr, len);
|
|
||||||
else
|
|
||||||
return hms_read_inferior_memory (memaddr, myaddr, len);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
hms_write_inferior_memory (memaddr, myaddr, len)
|
hms_write_inferior_memory (memaddr, myaddr, len)
|
||||||
CORE_ADDR memaddr;
|
CORE_ADDR memaddr;
|
||||||
char *myaddr;
|
unsigned char *myaddr;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
|
bfd_vma addr;
|
||||||
|
int done;
|
||||||
|
int todo ;
|
||||||
|
done = 0;
|
||||||
|
while(done < len)
|
||||||
|
{
|
||||||
|
char buffer[20];
|
||||||
|
int thisgo;
|
||||||
|
int idx;
|
||||||
|
thisgo = len - done;
|
||||||
|
if (thisgo > 20) thisgo = 20;
|
||||||
|
|
||||||
bfd *abfd = bfd_openw(dev_name, "srec");
|
sprintf(buffer,"M.B %4x =", memaddr+done);
|
||||||
asection *a;
|
hms_write(buffer,10);
|
||||||
|
for (idx = 0; idx < thisgo; idx++)
|
||||||
|
{
|
||||||
|
char buf[20];
|
||||||
|
sprintf(buf, "%2x ", myaddr[idx+done]);
|
||||||
|
hms_write(buf, 3);
|
||||||
|
}
|
||||||
|
hms_write_cr("");
|
||||||
|
expect_prompt();
|
||||||
|
done += thisgo;
|
||||||
|
}
|
||||||
|
|
||||||
bfd_set_format(abfd, bfd_object);
|
|
||||||
a = bfd_make_section(abfd, ".text");
|
|
||||||
a->vma = memaddr;
|
|
||||||
a->_raw_size = len;
|
|
||||||
a->flags = SEC_LOAD | SEC_HAS_CONTENTS;
|
|
||||||
hms_write_cr("tl"); /* tell hms here comes the recs */
|
|
||||||
bfd_set_section_contents(abfd, a, myaddr, 0, len);
|
|
||||||
bfd_close(abfd);
|
|
||||||
|
|
||||||
expect_prompt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hms_files_info ()
|
hms_files_info ()
|
||||||
{
|
{
|
||||||
printf_filtered("\tAttached to %s at %d baud and running program %s\n",
|
char *file = "nothing";
|
||||||
dev_name, baudrate, bfd_get_filename(exec_bfd));
|
if (exec_bfd)
|
||||||
|
file = bfd_get_filename(exec_bfd);
|
||||||
|
|
||||||
|
if (exec_bfd)
|
||||||
|
#ifdef __GO32__
|
||||||
|
printf_filtered("\tAttached to DOS asynctsr and running program %s\n",file);
|
||||||
|
#else
|
||||||
|
printf_filtered("\tAttached to %s at %d baud and running program %s\n",file);
|
||||||
|
#endif
|
||||||
printf_filtered("\ton an H8/300 processor.\n");
|
printf_filtered("\ton an H8/300 processor.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1431,17 +1268,9 @@ hms_read_inferior_memory(memaddr, myaddr, len)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hms_write_cr(" ");
|
hms_write_cr(" ");
|
||||||
expect_prompt();
|
expect_prompt();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This routine is run as a hook, just before the main command loop is
|
/* This routine is run as a hook, just before the main command loop is
|
||||||
|
@ -1457,29 +1286,6 @@ hms_before_main_loop ()
|
||||||
extern jmp_buf to_top_level;
|
extern jmp_buf to_top_level;
|
||||||
|
|
||||||
push_target (&hms_ops);
|
push_target (&hms_ops);
|
||||||
#if 0
|
|
||||||
|
|
||||||
while (current_target != &hms_ops) {
|
|
||||||
/* remote tty not specified yet */
|
|
||||||
if ( instream == stdin ){
|
|
||||||
printf("\nEnter device and filename, or \"quit\" to quit: ");
|
|
||||||
fflush( stdout );
|
|
||||||
}
|
|
||||||
fgets( ttyname, sizeof(ttyname)-1, stdin );
|
|
||||||
|
|
||||||
if ( !strcmp("quit", ttyname) ){
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
hms_open( ttyname, 1 );
|
|
||||||
|
|
||||||
/* Now that we have a tty open for talking to the remote machine,
|
|
||||||
download the executable file if one was specified. */
|
|
||||||
if ( !setjmp(to_top_level) && exec_bfd ) {
|
|
||||||
target_load (bfd_get_filename (exec_bfd), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1490,24 +1296,26 @@ hms_insert_breakpoint(addr, save)
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
char *save; /* Throw away, let hms save instructions */
|
char *save; /* Throw away, let hms save instructions */
|
||||||
{
|
{
|
||||||
|
|
||||||
DENTER("hms_insert_breakpoint()");
|
DENTER("hms_insert_breakpoint()");
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
if (num_brkpts < MAX_BREAKS) {
|
if (num_brkpts < MAX_BREAKS)
|
||||||
char buffer[100];
|
{
|
||||||
num_brkpts++;
|
char buffer[100];
|
||||||
sprintf(buffer,"b %x", addr & 0xffff);
|
num_brkpts++;
|
||||||
hms_write_cr(buffer);
|
sprintf(buffer,"b %x", addr & 0xffff);
|
||||||
expect_prompt ();
|
hms_write_cr(buffer);
|
||||||
DEXIT("hms_insert_breakpoint() success");
|
expect_prompt ();
|
||||||
return(0); /* Success */
|
DEXIT("hms_insert_breakpoint() success");
|
||||||
} else {
|
return(0);
|
||||||
fprintf_filtered(stderr,
|
}
|
||||||
"Too many break points, break point not installed\n");
|
else
|
||||||
DEXIT("hms_insert_breakpoint() failure");
|
{
|
||||||
return(1); /* Failure */
|
fprintf_filtered(stderr,
|
||||||
}
|
"Too many break points, break point not installed\n");
|
||||||
|
DEXIT("hms_insert_breakpoint() failure");
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1517,15 +1325,16 @@ CORE_ADDR addr;
|
||||||
char *save; /* Throw away, let hms save instructions */
|
char *save; /* Throw away, let hms save instructions */
|
||||||
{
|
{
|
||||||
DENTER("hms_remove_breakpoint()");
|
DENTER("hms_remove_breakpoint()");
|
||||||
if (num_brkpts > 0) {
|
if (num_brkpts > 0)
|
||||||
char buffer[100];
|
{
|
||||||
|
char buffer[100];
|
||||||
|
|
||||||
num_brkpts--;
|
num_brkpts--;
|
||||||
sprintf(buffer,"b - %x", addr & 0xffff);
|
sprintf(buffer,"b - %x", addr & 0xffff);
|
||||||
hms_write_cr(buffer);
|
hms_write_cr(buffer);
|
||||||
expect_prompt();
|
expect_prompt();
|
||||||
|
|
||||||
}
|
}
|
||||||
DEXIT("hms_remove_breakpoint()");
|
DEXIT("hms_remove_breakpoint()");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -1536,12 +1345,11 @@ hms_clear_breakpoints()
|
||||||
{
|
{
|
||||||
|
|
||||||
DENTER("hms_clear_breakpoint()");
|
DENTER("hms_clear_breakpoint()");
|
||||||
if (OPEN(hms_desc)) {
|
if (is_open) {
|
||||||
hms_write_cr("b -");
|
hms_write_cr("b -");
|
||||||
expect_prompt ();
|
expect_prompt ();
|
||||||
}
|
}
|
||||||
num_brkpts = 0;
|
num_brkpts = 0;
|
||||||
|
|
||||||
DEXIT("hms_clear_breakpoint()");
|
DEXIT("hms_clear_breakpoint()");
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
|
@ -1549,39 +1357,14 @@ hms_mourn()
|
||||||
{
|
{
|
||||||
DENTER("hms_mourn()");
|
DENTER("hms_mourn()");
|
||||||
hms_clear_breakpoints();
|
hms_clear_breakpoints();
|
||||||
/* pop_target (); /* Pop back to no-child state */
|
|
||||||
generic_mourn_inferior ();
|
generic_mourn_inferior ();
|
||||||
DEXIT("hms_mourn()");
|
DEXIT("hms_mourn()");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display everthing we read in from the hms until we match/see the
|
|
||||||
* specified string
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
display_until(str)
|
|
||||||
char *str;
|
|
||||||
{
|
|
||||||
int i=0,j,c;
|
|
||||||
|
|
||||||
while (c=readchar()) {
|
|
||||||
if (c==str[i]) {
|
|
||||||
i++;
|
|
||||||
if (i == strlen(str)) return;
|
|
||||||
} else {
|
|
||||||
if (i) {
|
|
||||||
for (j=0 ; j<i ; j++) /* Put everthing we matched */
|
|
||||||
putchar(str[j]);
|
|
||||||
i=0;
|
|
||||||
}
|
|
||||||
putchar(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Put a command string, in args, out to the hms. The hms is assumed to
|
/* Put a command string, in args, out to the hms. The hms is assumed to
|
||||||
be in raw mode, all writing/reading done through hms_desc.
|
be in raw mode, all writing/reading done through desc.
|
||||||
Ouput from the hms is placed on the users terminal until the
|
Ouput from the hms is placed on the users terminal until the
|
||||||
prompt from the hms is seen.
|
prompt from the hms is seen.
|
||||||
FIXME: Can't handle commands that take input. */
|
FIXME: Can't handle commands that take input. */
|
||||||
|
@ -1597,11 +1380,9 @@ hms_com (args, fromtty)
|
||||||
|
|
||||||
/* Clear all input so only command relative output is displayed */
|
/* Clear all input so only command relative output is displayed */
|
||||||
|
|
||||||
|
|
||||||
hms_write_cr(args);
|
hms_write_cr(args);
|
||||||
hms_write("\030",1);
|
hms_write("\030",1);
|
||||||
expect_prompt();
|
expect_prompt();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define the target subroutine names */
|
/* Define the target subroutine names */
|
||||||
|
@ -1633,37 +1414,37 @@ by a serial line.",
|
||||||
|
|
||||||
hms_quiet()
|
hms_quiet()
|
||||||
{
|
{
|
||||||
quiet = ! quiet;
|
quiet = ! quiet;
|
||||||
|
if (quiet)
|
||||||
|
printf_filtered("Snoop disabled\n");
|
||||||
|
else
|
||||||
|
printf_filtered("Snoop enabled\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hms_device(s)
|
hms_device(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
if (s) {
|
if (s)
|
||||||
dev_name = get_word(&s);
|
{
|
||||||
}
|
dev_name = get_word(&s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
hms_speed(s)
|
hms_speed(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
int newrate = atoi(s);
|
int newrate = atoi(s);
|
||||||
int which = 0;
|
int which = 0;
|
||||||
while (baudtab[which].rate != newrate)
|
if (!serial_setbaudrate(newrate))
|
||||||
{
|
|
||||||
if (baudtab[which].rate == -1)
|
|
||||||
{
|
|
||||||
error("Can't use %d baud\n", newrate);
|
error("Can't use %d baud\n", newrate);
|
||||||
}
|
|
||||||
which++;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf_filtered("Checking target is in sync\n");
|
printf_filtered("Checking target is in sync\n");
|
||||||
|
|
||||||
|
@ -1687,12 +1468,14 @@ _initialize_remote_hms ()
|
||||||
"Send a command to the HMS monitor.");
|
"Send a command to the HMS monitor.");
|
||||||
add_com ("snoop", class_obscure, hms_quiet,
|
add_com ("snoop", class_obscure, hms_quiet,
|
||||||
"Show what commands are going to the monitor");
|
"Show what commands are going to the monitor");
|
||||||
|
|
||||||
add_com ("device", class_obscure, hms_device,
|
add_com ("device", class_obscure, hms_device,
|
||||||
"Set the terminal line for HMS communications");
|
"Set the terminal line for HMS communications");
|
||||||
|
|
||||||
add_com ("speed", class_obscure, hms_speed,
|
add_com ("speed", class_obscure, hms_speed,
|
||||||
"Set the terminal line speed for HMS communications");
|
"Set the terminal line speed for HMS communications");
|
||||||
|
|
||||||
|
dev_name = serial_default_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
330
gdb/ser-go32.c
Normal file
330
gdb/ser-go32.c
Normal file
|
@ -0,0 +1,330 @@
|
||||||
|
/* Remote serial interface for GO32
|
||||||
|
|
||||||
|
Copyright 1992
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/dos.h>
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define SIGNATURE 0x4154
|
||||||
|
#define VERSION 1
|
||||||
|
#define OFFSET 0x104
|
||||||
|
|
||||||
|
/*#define MONO 1*/
|
||||||
|
|
||||||
|
#define dprintf if(0)printf
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define far
|
||||||
|
#define peek(a,b) (*(unsigned short *)(0xe0000000 + (a)*16 + (b)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short jmp_op;
|
||||||
|
short signature;
|
||||||
|
short version;
|
||||||
|
short buffer_start;
|
||||||
|
short buffer_end;
|
||||||
|
short getp;
|
||||||
|
short putp;
|
||||||
|
short iov;
|
||||||
|
} ASYNC_STRUCT;
|
||||||
|
|
||||||
|
static ASYNC_STRUCT far *async;
|
||||||
|
static int iov;
|
||||||
|
#define com_rb iov
|
||||||
|
#define com_tb iov
|
||||||
|
#define com_ier iov+1
|
||||||
|
#define com_ifr iov+2
|
||||||
|
#define com_bfr iov+3
|
||||||
|
#define com_mcr iov+4
|
||||||
|
#define com_lsr iov+5
|
||||||
|
#define com_msr iov+6
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
#include <sys/pc.h>
|
||||||
|
static int mono_pos=0;
|
||||||
|
#define mono_rx 0x07
|
||||||
|
#define mono_tx 0x70
|
||||||
|
|
||||||
|
void mono_put(char byte, char attr)
|
||||||
|
{
|
||||||
|
ScreenSecondary[320+mono_pos+80] = 0x0720;
|
||||||
|
ScreenSecondary[320+mono_pos] = (attr<<8) | (byte&0xff);
|
||||||
|
mono_pos = (mono_pos+1) % 1200;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char far *aptr(short p)
|
||||||
|
{
|
||||||
|
#ifdef __GNUC__
|
||||||
|
return (char *)((unsigned)async - OFFSET + p);
|
||||||
|
#else
|
||||||
|
return (char far *)MK_FP(FP_SEG(async), p);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ASYNC_STRUCT far *getivec(int which)
|
||||||
|
{
|
||||||
|
ASYNC_STRUCT far *a;
|
||||||
|
|
||||||
|
if (peek(0, which*4) != OFFSET)
|
||||||
|
return 0;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
a = (ASYNC_STRUCT *)(0xe0000000 + peek(0, which*4+2)*16 + peek(0, which*4));
|
||||||
|
|
||||||
|
#else
|
||||||
|
a = (ASYNC_STRUCT far *)MK_FP(peek(0,which*4+2),peek(0,which*4));
|
||||||
|
#endif
|
||||||
|
if (a->signature != SIGNATURE)
|
||||||
|
return 0;
|
||||||
|
if (a->version != VERSION)
|
||||||
|
return 0;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dos_async_init()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
ASYNC_STRUCT far *a1;
|
||||||
|
ASYNC_STRUCT far *a2;
|
||||||
|
a1 = getivec(12);
|
||||||
|
a2 = getivec(11);
|
||||||
|
async = 0;
|
||||||
|
if (a1)
|
||||||
|
async = a1;
|
||||||
|
if (a2)
|
||||||
|
async = a2;
|
||||||
|
if (a1 && a2)
|
||||||
|
{
|
||||||
|
if (a1 < a2)
|
||||||
|
async = a1;
|
||||||
|
else
|
||||||
|
async = a2;
|
||||||
|
}
|
||||||
|
if (async == 0)
|
||||||
|
{
|
||||||
|
error("GDB can not connect to asynctsr program, check that it is installed\n\
|
||||||
|
and that serial I/O is not being redirected (perhaps by NFS)\n\n\
|
||||||
|
example configuration:\n\
|
||||||
|
C> mode com2:9600,n,8,1,p\n\
|
||||||
|
C> asynctsr 2\n\
|
||||||
|
C> gdb \n");
|
||||||
|
|
||||||
|
}
|
||||||
|
iov = async->iov;
|
||||||
|
outportb(com_ier, 0x0f);
|
||||||
|
outportb(com_bfr, 0x03);
|
||||||
|
outportb(com_mcr, 0x0b);
|
||||||
|
async->getp = async->putp = async->buffer_start;
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
for (i=0; i<1200; i++)
|
||||||
|
ScreenSecondary[320+i] = 0x0720;
|
||||||
|
#endif
|
||||||
|
if (iov > 0x300)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
dos_async_tx(char c)
|
||||||
|
{
|
||||||
|
dprintf("dos_async_tx: enter %x - with IOV %x", c, com_lsr);
|
||||||
|
fflush(stdout);
|
||||||
|
while (~inportb(com_lsr) & 0x20);
|
||||||
|
outportb(com_tb, c);
|
||||||
|
#if MONO
|
||||||
|
mono_put(c, mono_tx);
|
||||||
|
#endif
|
||||||
|
dprintf("exit\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int dos_async_ready()
|
||||||
|
{
|
||||||
|
return (async->getp != async->putp);
|
||||||
|
}
|
||||||
|
|
||||||
|
int dos_async_rx()
|
||||||
|
{
|
||||||
|
char rv;
|
||||||
|
dprintf("dos_async_rx: enter - ");
|
||||||
|
fflush(stdout);
|
||||||
|
while (!dos_async_ready())
|
||||||
|
if (kbhit())
|
||||||
|
{
|
||||||
|
printf("abort!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
dprintf("async=%x getp=%x\n", async, async->getp);
|
||||||
|
fflush(stdout);
|
||||||
|
rv = *aptr(async->getp++);
|
||||||
|
#if MONO
|
||||||
|
mono_put(rv, mono_rx);
|
||||||
|
#endif
|
||||||
|
if (async->getp >= async->buffer_end)
|
||||||
|
async->getp = async->buffer_start;
|
||||||
|
dprintf("exit %x\n", rv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dos_kb_ready()
|
||||||
|
{
|
||||||
|
return (peek(0x40,0x1a) != peek(0x40,0x1c));
|
||||||
|
}
|
||||||
|
|
||||||
|
int dos_kb_rx()
|
||||||
|
{
|
||||||
|
#ifdef __GNUC__
|
||||||
|
return getkey();
|
||||||
|
#else
|
||||||
|
return getch();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int dosasync_read(int fd, char *buffer, int length, int timeout)
|
||||||
|
{
|
||||||
|
long now, then;
|
||||||
|
int l = length;
|
||||||
|
time (&now);
|
||||||
|
then = now+timeout;
|
||||||
|
dprintf("dosasync_read: enter(%d,%d)\n", length, timeout);
|
||||||
|
while (l--)
|
||||||
|
{
|
||||||
|
if (timeout)
|
||||||
|
{
|
||||||
|
while (!dos_async_ready())
|
||||||
|
{
|
||||||
|
time (&now);
|
||||||
|
if (now == then)
|
||||||
|
{
|
||||||
|
dprintf("dosasync_read: timeout(%d)\n", length-l-1);
|
||||||
|
return length-l-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*buffer++ = dos_async_rx();
|
||||||
|
}
|
||||||
|
dprintf("dosasync_read: exit %d\n", length);
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dosasync_write(int fd, CONST char *buffer, int length)
|
||||||
|
{
|
||||||
|
int l = length;
|
||||||
|
while (l--)
|
||||||
|
dos_async_tx(*buffer++);
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *strlwr(char *s)
|
||||||
|
{
|
||||||
|
char *p = s;
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
if ((*s >= 'A') && (*s <= 'Z'))
|
||||||
|
*s += 'a'-'A';
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
sigsetmask() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int fd;
|
||||||
|
|
||||||
|
CONST char *
|
||||||
|
DEFUN_VOID(serial_default_name)
|
||||||
|
{
|
||||||
|
return "com1";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DEFUN_VOID(serial_raw)
|
||||||
|
{
|
||||||
|
/* Always in raw mode */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_open,(name),
|
||||||
|
CONST char *name)
|
||||||
|
{
|
||||||
|
fd = dos_async_init();
|
||||||
|
if (fd) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_timedreadchar,(to, ok),
|
||||||
|
int to AND
|
||||||
|
int *ok)
|
||||||
|
{
|
||||||
|
char buf;
|
||||||
|
if ( dosasync_read(fd, &buf, 1, to))
|
||||||
|
{
|
||||||
|
*ok = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ok = 0;
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_setbaudrate,(rate),
|
||||||
|
int rate)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_nextbaudrate,(rate),
|
||||||
|
int rate)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_write,(str, len),
|
||||||
|
CONST char *str AND
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
dosasync_write(fd, str, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN_VOID(serial_close)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
208
gdb/ser-termios.c
Normal file
208
gdb/ser-termios.c
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
/* Remote serial interface for OS's with termios
|
||||||
|
|
||||||
|
Copyright 1992
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "serial.h"
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
static int desc;
|
||||||
|
|
||||||
|
|
||||||
|
CONST char *
|
||||||
|
DEFUN_VOID(serial_default_name)
|
||||||
|
{
|
||||||
|
return "/dev/ttya";
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DEFUN_VOID(serial_raw)
|
||||||
|
{
|
||||||
|
/* Now happens inside of serial_open */
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct termios otermios;
|
||||||
|
static int oflags;
|
||||||
|
|
||||||
|
void
|
||||||
|
DEFUN_VOID(serial_normal)
|
||||||
|
{
|
||||||
|
fcntl(desc, oflags, 0);
|
||||||
|
|
||||||
|
if (tcsetattr(desc, TCSANOW, &otermios))
|
||||||
|
{
|
||||||
|
printf("tcgetattr failed: errno=%d\n", errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_open,(name),
|
||||||
|
CONST char *name)
|
||||||
|
{
|
||||||
|
struct termios termios;
|
||||||
|
|
||||||
|
desc = open (name, O_RDWR);
|
||||||
|
if (desc < 0)
|
||||||
|
perror("Open failed: ");
|
||||||
|
|
||||||
|
oflags = fcntl(desc, F_GETFL, 0);
|
||||||
|
|
||||||
|
fcntl(desc, F_SETFL, oflags|FNDELAY);
|
||||||
|
|
||||||
|
if (tcgetattr(desc, &termios)) {
|
||||||
|
printf("tcgetattr failed: errno=%d\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
otermios = termios;
|
||||||
|
|
||||||
|
termios.c_iflag = 0;
|
||||||
|
termios.c_oflag = 0;
|
||||||
|
termios.c_lflag = 0;
|
||||||
|
termios.c_cc[VMIN] = 0;
|
||||||
|
termios.c_cc[VTIME] = 0;
|
||||||
|
|
||||||
|
if (tcsetattr(desc, TCSANOW, &termios)) {
|
||||||
|
printf("tcgetattr failed: errno=%d\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_timedreadchar,(timeout, ok),
|
||||||
|
int timeout AND
|
||||||
|
int *ok)
|
||||||
|
{
|
||||||
|
unsigned char buf;
|
||||||
|
fd_set readfds;
|
||||||
|
int val;
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
FD_ZERO(&readfds);
|
||||||
|
FD_SET(desc, &readfds);
|
||||||
|
|
||||||
|
tv.tv_sec = timeout;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
|
val = select(desc+1, &readfds, 0, 0, &tv);
|
||||||
|
|
||||||
|
if (val > 0 && FD_ISSET(desc, &readfds))
|
||||||
|
{
|
||||||
|
val = read (desc, &buf, 1);
|
||||||
|
|
||||||
|
if (val == 1)
|
||||||
|
{
|
||||||
|
*ok = 1;
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*ok = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Translate baud rates from integers to damn B_codes. Unix should
|
||||||
|
have outgrown this crap years ago, but even POSIX wouldn't buck it. */
|
||||||
|
|
||||||
|
#ifndef B19200
|
||||||
|
#define B19200 EXTA
|
||||||
|
#endif
|
||||||
|
#ifndef B38400
|
||||||
|
#define B38400 EXTB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct {int rate, damn_b;} baudtab[] = {
|
||||||
|
{9600, B9600},
|
||||||
|
|
||||||
|
{19200, B19200},
|
||||||
|
#if 0
|
||||||
|
{300, B300},
|
||||||
|
{1200, B1200},
|
||||||
|
{2400, B2400},
|
||||||
|
{4800, B4800},
|
||||||
|
#endif
|
||||||
|
{-1, -1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
DEFUN(damn_b,(rate),
|
||||||
|
int rate)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; baudtab[i].rate != -1; i++)
|
||||||
|
{
|
||||||
|
if (rate == baudtab[i].rate)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_setbaudrate,(rate),int rate)
|
||||||
|
{
|
||||||
|
struct termios termios;
|
||||||
|
|
||||||
|
if (tcgetattr(desc, &termios)) {
|
||||||
|
printf("tcgetattr failed: errno=%d\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
cfsetospeed(&termios, baudtab[damn_b(rate)].damn_b);
|
||||||
|
cfsetispeed(&termios, baudtab[damn_b(rate)].damn_b);
|
||||||
|
|
||||||
|
if (tcsetattr(desc, TCSANOW, &termios)) {
|
||||||
|
printf("tcgetattr failed: errno=%d\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_nextbaudrate,(rate),
|
||||||
|
int rate)
|
||||||
|
{
|
||||||
|
int lookup;
|
||||||
|
lookup = damn_b(rate);
|
||||||
|
if (lookup == -1)
|
||||||
|
return baudtab[0].rate;
|
||||||
|
lookup++;
|
||||||
|
if (baudtab[lookup].rate == -1)
|
||||||
|
return baudtab[0].rate;
|
||||||
|
return baudtab[lookup].rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN(serial_write,(str, len),
|
||||||
|
CONST char *str AND
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
write (desc, str, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DEFUN_VOID(serial_close)
|
||||||
|
{
|
||||||
|
close(desc);
|
||||||
|
}
|
62
gdb/serial.h
Normal file
62
gdb/serial.h
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/* Remote Serial support interface definitions for GDB, the GNU Debugger.
|
||||||
|
Copyright 1992 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
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. */
|
||||||
|
|
||||||
|
/* Return a sensible default name for a serial device, something which
|
||||||
|
can be used as an argument to serial_open */
|
||||||
|
|
||||||
|
CONST char *EXFUN(serial_default_name,(void));
|
||||||
|
|
||||||
|
/* Try to open the serial device "name", return 1 if ok, 0 if not. */
|
||||||
|
|
||||||
|
int EXFUN(serial_open,(CONST char *name));
|
||||||
|
|
||||||
|
/* Turn the port into raw mode */
|
||||||
|
|
||||||
|
void EXFUN(serial_raw,(void));
|
||||||
|
|
||||||
|
|
||||||
|
/* Turn the port into normal mode */
|
||||||
|
|
||||||
|
void EXFUN(serial_normal,(void));
|
||||||
|
|
||||||
|
|
||||||
|
/* Read one char from the serial device with timeout, return char, and
|
||||||
|
set ok if ok */
|
||||||
|
|
||||||
|
int EXFUN(serial_timedreadchar,(int to , int *ok));
|
||||||
|
|
||||||
|
|
||||||
|
/* Set the baudrate to the value supplied, and return 1, or fail and
|
||||||
|
return 0 */
|
||||||
|
|
||||||
|
int EXFUN(serial_setbaudrate,(int to));
|
||||||
|
|
||||||
|
/* Return the next rate in the sequence, or return 0 for a fail*/
|
||||||
|
|
||||||
|
int EXFUN(serial_nextbaudrate,(int rate));
|
||||||
|
|
||||||
|
|
||||||
|
/* Write some chars to the device, return 1 if ok, 0 if not */
|
||||||
|
|
||||||
|
int EXFUN(serial_write,( CONST char *str , int len));
|
||||||
|
|
||||||
|
|
||||||
|
/* Close the serial port */
|
||||||
|
|
||||||
|
int EXFUN(serial_close,(void));
|
|
@ -287,9 +287,9 @@ UNSIGNED_SHORT(read_memory_integer (read_register (SP_REGNUM), 2))
|
||||||
|
|
||||||
|
|
||||||
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
|
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
|
||||||
{ bcopy ((FROM), (TO), 2); }
|
{ memcpy((TO), (FROM), 2); }
|
||||||
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
|
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
|
||||||
{ bcopy ((FROM), (TO), 4); }
|
{ memcpy((TO), (FROM), 2); }
|
||||||
|
|
||||||
#define BEFORE_MAIN_LOOP_HOOK \
|
#define BEFORE_MAIN_LOOP_HOOK \
|
||||||
hms_before_main_loop();
|
hms_before_main_loop();
|
||||||
|
@ -303,3 +303,5 @@ typedef unsigned short INSN_WORD;
|
||||||
#define ADDR_BITS_SET(addr) (((addr)))
|
#define ADDR_BITS_SET(addr) (((addr)))
|
||||||
|
|
||||||
#define read_memory_short(x) (read_memory_integer(x,2) & 0xffff)
|
#define read_memory_short(x) (read_memory_integer(x,2) & 0xffff)
|
||||||
|
#define DONT_USE_REMOTE
|
||||||
|
|
||||||
|
|
|
@ -551,7 +551,7 @@ value_as_pointer (val)
|
||||||
{
|
{
|
||||||
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
|
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
|
||||||
whether we want this to be true eventually. */
|
whether we want this to be true eventually. */
|
||||||
return value_as_long (val);
|
return ADDR_BITS_REMOVE(value_as_long (val));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unpack raw data (copied from debugee, target byte order) at VALADDR
|
/* Unpack raw data (copied from debugee, target byte order) at VALADDR
|
||||||
|
@ -705,14 +705,14 @@ unpack_long (type, valaddr)
|
||||||
{
|
{
|
||||||
if (len == sizeof(long))
|
if (len == sizeof(long))
|
||||||
{
|
{
|
||||||
long retval;
|
unsigned long retval;
|
||||||
bcopy (valaddr, &retval, sizeof(retval));
|
bcopy (valaddr, &retval, sizeof(retval));
|
||||||
SWAP_TARGET_AND_HOST (&retval, sizeof(retval));
|
SWAP_TARGET_AND_HOST (&retval, sizeof(retval));
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
else if (len == sizeof(short))
|
else if (len == sizeof(short))
|
||||||
{
|
{
|
||||||
short retval;
|
unsigned short retval;
|
||||||
bcopy (valaddr, &retval, len);
|
bcopy (valaddr, &retval, len);
|
||||||
SWAP_TARGET_AND_HOST (&retval, len);
|
SWAP_TARGET_AND_HOST (&retval, len);
|
||||||
return retval;
|
return retval;
|
||||||
|
|
5
gdb/xm-go32.h
Normal file
5
gdb/xm-go32.h
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#undef EIO
|
||||||
|
#define EIO 0
|
||||||
|
#define SYS_SIGLIST_MISSING 1
|
||||||
|
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
#include "fopen-bin.h"
|
Loading…
Add table
Reference in a new issue