* Makefile.in: Add mswin to SUBDIRS. Add rules for
mswin/libwingdb.a and remote-wiggler.o. * breakpoint.c (breakpoint_here_p): Clean up bp enabled test. * (breakpoint_inserted_here_p): New func, just like breakpoint_here_p, except it's honest. Honestly. * breakpoint.h: Proto for above. start-sanitize-gdbtk * configure configure.in: Add host *windows* to list of hosts that don't support GDBtk. end-sanitize-gdbtk * configure configure.in: Add mswin to configdirs if host is i[3456]86-*-windows. * core-aout.c (fetch_core_registers register_addr) gdbcore.h: Change all vars that can contain addresses to type CORE_ADDR. * findvar.c (supply_register): Allow val to be NULL. This means that regno is unsupported. * (read_pc read_pc_pid write_pc write_pc_pid): Make non-pid forms just call pid forms with inferior_pid so that there's only once place to hack PC's and such. * infrun.c (proceed): Don't skip breakpoints if user changed PC. * remote-wiggler.c: New file. Support for BDM interface from Macraigor Systems. * serial.c: Enhance serial logging capability. Add hex and octal output modes (set remotelogbase {hex|octal|ascii}. Also log breaks, timeouts, errors, and eofs. * serial.h: Redefine SERIAL_SEND_BREAK to go through a wrapper function so that we can log breaks. Don't export serial_logfile or serial_logfp. * top.c (execute_command): Don't test for serial_logfp here. Just call serial_log_comand, and let serial.c sort it out. * valops.c (value_of_variable): Don't attempt to establish frames for static and global variables. This makes things work a bit better if the stack or frame pointer is trashed. * config/m68k/monitor.mt (TDEPFILES): Add remote-wiggler.o. * config/m68k/tm-m68k.h: Define STACK_ALIGN. CPU32 can't hack misaligned stacks during function calls.
This commit is contained in:
parent
91f6cfead2
commit
d9951af428
@ -487,7 +487,7 @@ NTSOBS = standalone.o
|
||||
|
||||
NTSSTART = kdb-start.o
|
||||
|
||||
SUBDIRS = doc testsuite nlm
|
||||
SUBDIRS = doc testsuite nlm mswin
|
||||
|
||||
# For now, shortcut the "configure GDB for fewer languages" stuff.
|
||||
YYFILES = c-exp.tab.c f-exp.tab.c m2-exp.tab.c
|
||||
@ -582,7 +582,9 @@ init.c: $(OBS) $(TSOBS)
|
||||
@rm -f init.c-tmp
|
||||
@echo '/* Do not modify this file. */' >init.c-tmp
|
||||
@echo '/* It is created automatically by the Makefile. */'>>init.c-tmp
|
||||
@echo 'void initialize_all_files () {' >>init.c-tmp
|
||||
@echo '#include "ansidecl.h"' >>init.c-tmp
|
||||
@echo 'extern void initialize_all_files PARAMS ((void));' >>init.c-tmp
|
||||
@echo 'void initialize_all_files PARAMS ((void)) {' >>init.c-tmp
|
||||
@for i in $(OBS) $(TSOBS); do \
|
||||
filename=`echo $$i | sed \
|
||||
-e '/^Onindy.o/d' \
|
||||
@ -601,7 +603,7 @@ init.c: $(OBS) $(TSOBS)
|
||||
case $$filename in \
|
||||
"") ;; \
|
||||
*) sed <$(srcdir)/$$filename >>init.c-tmp -n \
|
||||
-e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (); \1 ();}/p' ; ;; \
|
||||
-e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/ {extern void \1 PARAMS ((void)); \1 ();}/p' ; ;; \
|
||||
esac ; \
|
||||
done
|
||||
@echo '}' >>init.c-tmp
|
||||
@ -620,6 +622,9 @@ nlm: force
|
||||
|
||||
libgdb: libgdb-files $(LIBGDB_OBS)
|
||||
|
||||
mswin/libwingdb.a: force
|
||||
rootme=`pwd`; export rootme; $(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=mswin subdir_do
|
||||
|
||||
# libproc is not listed here because all-libproc is a dependency of all-gui,
|
||||
# not all-gdb, and thus might be built after us.
|
||||
LIBGDBDEPS=$(COMMON_OBS) $(LIBGDB_OBS) $(TSOBS) $(ADD_DEPS) $(CDEPS) init.o
|
||||
@ -1406,6 +1411,9 @@ remote-vx29k.o: remote-vx29k.c $(wait_h) complaints.h $(defs_h) $(gdbcmd_h) \
|
||||
vx-share/ptrace.h vx-share/xdr_ld.h vx-share/xdr_ptrace.h \
|
||||
vx-share/xdr_rdb.h gdb_string.h
|
||||
|
||||
remote-wiggler.o: remote-wiggler.c $(wait_h) complaints.h $(defs_h) \
|
||||
$(gdbcmd_h) $(gdbcore_h) $(inferior_h) target.h
|
||||
|
||||
remote-utils.o: remote-utils.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
|
||||
$(inferior_h) $(remote_utils_h) gdb_string.h
|
||||
|
||||
|
@ -57,6 +57,10 @@ extern void m68k_find_saved_regs PARAMS ((struct frame_info *, struct frame_save
|
||||
|
||||
#define INNER_THAN <
|
||||
|
||||
/* Stack must be kept short aligned when doing function calls. */
|
||||
|
||||
#define STACK_ALIGN(ADDR) (((ADDR) + 1) & ~1)
|
||||
|
||||
/* Sequence of bytes for breakpoint instruction.
|
||||
This is a TRAP instruction. The last 4 bits (0xf below) is the
|
||||
vector. Systems which don't use 0xf should define BPT_VECTOR
|
||||
|
160
gdb/configure
vendored
160
gdb/configure
vendored
@ -1869,147 +1869,9 @@ EOF
|
||||
fi
|
||||
|
||||
|
||||
echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1878 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
int main() { return 0; }
|
||||
int t() {
|
||||
char *(*pfn) = (char *(*)) malloc
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
bfd_cv_decl_needed_malloc=no
|
||||
else
|
||||
rm -rf conftest*
|
||||
bfd_cv_decl_needed_malloc=yes
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
|
||||
echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6
|
||||
if test $bfd_cv_decl_needed_malloc = yes; then
|
||||
bfd_tr_decl=NEED_DECLARATION_`echo malloc | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||
cat >> confdefs.h <<EOF
|
||||
#define $bfd_tr_decl 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1925 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
int main() { return 0; }
|
||||
int t() {
|
||||
char *(*pfn) = (char *(*)) realloc
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
bfd_cv_decl_needed_realloc=no
|
||||
else
|
||||
rm -rf conftest*
|
||||
bfd_cv_decl_needed_realloc=yes
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
|
||||
echo "$ac_t""$bfd_cv_decl_needed_realloc" 1>&6
|
||||
if test $bfd_cv_decl_needed_realloc = yes; then
|
||||
bfd_tr_decl=NEED_DECLARATION_`echo realloc | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||
cat >> confdefs.h <<EOF
|
||||
#define $bfd_tr_decl 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1972 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
int main() { return 0; }
|
||||
int t() {
|
||||
char *(*pfn) = (char *(*)) free
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
bfd_cv_decl_needed_free=no
|
||||
else
|
||||
rm -rf conftest*
|
||||
bfd_cv_decl_needed_free=yes
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
|
||||
echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6
|
||||
if test $bfd_cv_decl_needed_free = yes; then
|
||||
bfd_tr_decl=NEED_DECLARATION_`echo free | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||
cat >> confdefs.h <<EOF
|
||||
#define $bfd_tr_decl 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
BFD_NEED_DECLARATION(malloc)
|
||||
BFD_NEED_DECLARATION(realloc)
|
||||
BFD_NEED_DECLARATION(free)
|
||||
|
||||
|
||||
|
||||
@ -2092,7 +1954,7 @@ if test "${enable_gdbtk+set}" = set; then
|
||||
*go32*)
|
||||
echo "configure: warning: GDB does not support GDBtk on host ${host}. GDBtk will be disabled." 1>&2
|
||||
enable_gdbtk=no ;;
|
||||
*cygwin32*)
|
||||
*cygwin32* | *windows*)
|
||||
echo "configure: warning: GDB does not support GDBtk on host ${host}. GDBtk will be disabled." 1>&2
|
||||
enable_gdbtk=no ;;
|
||||
*)
|
||||
@ -2107,9 +1969,7 @@ else
|
||||
|
||||
# Default is on for everything but go32 and cygwin32
|
||||
case "$host" in
|
||||
*go32*)
|
||||
;;
|
||||
*cygwin32*)
|
||||
*go32* | *cygwin32* | *windows*)
|
||||
;;
|
||||
*)
|
||||
enable_gdbtk=yes ;;
|
||||
@ -2406,12 +2266,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2410 "configure"
|
||||
#line 2270 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <tclInt.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2415: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:2275: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@ -2538,12 +2398,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2542 "configure"
|
||||
#line 2402 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <tk.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:2407: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@ -2685,6 +2545,8 @@ i[3456]86-*-sysv*) gdb_host=i386v ;;
|
||||
i[3456]86-*-isc*) gdb_host=i386v32 ;;
|
||||
i[3456]86-*-os9k) gdb_host=i386os9k ;;
|
||||
i[3456]86-*-cygwin32) gdb_host=cygwin32 ;;
|
||||
i[3456]86-*-windows) gdb_host=windows
|
||||
configdirs="${configdirs} mswin" ;;
|
||||
m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;;
|
||||
m680[01]0-sun-sunos4*) gdb_host=sun2os4 ;;
|
||||
m68030-sony-*) gdb_host=news1000 ;;
|
||||
|
@ -208,7 +208,7 @@ AC_ARG_ENABLE(gdbtk,
|
||||
*go32*)
|
||||
AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
|
||||
enable_gdbtk=no ;;
|
||||
*cygwin32*)
|
||||
*cygwin32* | *windows*)
|
||||
AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
|
||||
enable_gdbtk=no ;;
|
||||
*)
|
||||
@ -222,9 +222,7 @@ esac],
|
||||
[
|
||||
# Default is on for everything but go32 and cygwin32
|
||||
case "$host" in
|
||||
*go32*)
|
||||
;;
|
||||
*cygwin32*)
|
||||
*go32* | *cygwin32* | *windows*)
|
||||
;;
|
||||
*)
|
||||
enable_gdbtk=yes ;;
|
||||
@ -346,6 +344,8 @@ i[3456]86-*-sysv*) gdb_host=i386v ;;
|
||||
i[3456]86-*-isc*) gdb_host=i386v32 ;;
|
||||
i[3456]86-*-os9k) gdb_host=i386os9k ;;
|
||||
i[3456]86-*-cygwin32) gdb_host=cygwin32 ;;
|
||||
i[3456]86-*-windows) gdb_host=windows
|
||||
configdirs="${configdirs} mswin" ;;
|
||||
m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;;
|
||||
m680[01]0-sun-sunos4*) gdb_host=sun2os4 ;;
|
||||
m68030-sony-*) gdb_host=news1000 ;;
|
||||
|
@ -52,8 +52,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include <sys/core.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
fetch_core_registers PARAMS ((char *, unsigned, int, unsigned));
|
||||
static void fetch_core_registers PARAMS ((char *core_reg_sect,
|
||||
unsigned core_reg_size, int which,
|
||||
CORE_ADDR reg_addr));
|
||||
|
||||
/* Extract the register values out of the core file and store
|
||||
them where `read_register' will find them.
|
||||
@ -73,12 +74,12 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
char *core_reg_sect;
|
||||
unsigned core_reg_size;
|
||||
int which;
|
||||
unsigned reg_addr;
|
||||
CORE_ADDR reg_addr;
|
||||
{
|
||||
register int regno;
|
||||
register unsigned int addr;
|
||||
int regno;
|
||||
CORE_ADDR addr;
|
||||
int bad_reg = -1;
|
||||
register reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
|
||||
CORE_ADDR reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
|
||||
int numregs = ARCH_NUM_REGS;
|
||||
|
||||
/* If u.u_ar0 was an absolute address in the core file, relativize it now,
|
||||
@ -87,23 +88,21 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
CORE_REGISTER_ADDR to offset to the other registers. If this is a modern
|
||||
core file without a upage, reg_ptr will be zero and this is all a big
|
||||
NOP. */
|
||||
if (reg_ptr > (int) core_reg_size)
|
||||
if (reg_ptr > core_reg_size)
|
||||
reg_ptr -= KERNEL_U_ADDR;
|
||||
|
||||
for (regno = 0; regno < numregs; regno++)
|
||||
{
|
||||
addr = CORE_REGISTER_ADDR (regno, reg_ptr);
|
||||
if (addr >= core_reg_size) {
|
||||
if (bad_reg < 0)
|
||||
bad_reg = regno;
|
||||
} else {
|
||||
supply_register (regno, core_reg_sect + addr);
|
||||
}
|
||||
if (addr >= core_reg_size
|
||||
&& bad_reg < 0)
|
||||
bad_reg = regno;
|
||||
else
|
||||
supply_register (regno, core_reg_sect + addr);
|
||||
}
|
||||
|
||||
if (bad_reg >= 0)
|
||||
{
|
||||
error ("Register %s not found in core file.", reg_names[bad_reg]);
|
||||
}
|
||||
error ("Register %s not found in core file.", reg_names[bad_reg]);
|
||||
}
|
||||
|
||||
|
||||
@ -112,12 +111,12 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||
/* Return the address in the core dump or inferior of register REGNO.
|
||||
BLOCKEND is the address of the end of the user structure. */
|
||||
|
||||
unsigned int
|
||||
CORE_ADDR
|
||||
register_addr (regno, blockend)
|
||||
int regno;
|
||||
int blockend;
|
||||
CORE_ADDR blockend;
|
||||
{
|
||||
int addr;
|
||||
CORE_ADDR addr;
|
||||
|
||||
if (regno < 0 || regno >= ARCH_NUM_REGS)
|
||||
error ("Invalid register number %d.", regno);
|
||||
|
1570
gdb/remote-wiggler.c
Normal file
1570
gdb/remote-wiggler.c
Normal file
File diff suppressed because it is too large
Load Diff
105
gdb/serial.c
105
gdb/serial.c
@ -38,11 +38,16 @@ static serial_t scb_base;
|
||||
/* Non-NULL gives filename which contains a recording of the remote session,
|
||||
suitable for playback by gdbserver. */
|
||||
|
||||
char *serial_logfile = NULL;
|
||||
FILE *serial_logfp = NULL;
|
||||
static char *serial_logfile = NULL;
|
||||
static FILE *serial_logfp = NULL;
|
||||
|
||||
static struct serial_ops *serial_interface_lookup PARAMS ((char *));
|
||||
static void serial_logchar PARAMS ((int));
|
||||
static void serial_logchar PARAMS ((int ch, int timeout));
|
||||
static char logbase_hex[] = "hex";
|
||||
static char logbase_octal[] = "octal";
|
||||
static char logbase_ascii[] = "ascii";
|
||||
static char *logbase_enums[] = {logbase_hex, logbase_octal, logbase_ascii, NULL};
|
||||
static char *serial_logbase = logbase_ascii;
|
||||
|
||||
|
||||
static int serial_reading = 0;
|
||||
@ -52,6 +57,9 @@ void
|
||||
serial_log_command (cmd)
|
||||
const char *cmd;
|
||||
{
|
||||
if (!serial_logfp)
|
||||
return;
|
||||
|
||||
if (serial_reading || serial_writing)
|
||||
{
|
||||
fputc_unfiltered ('\n', serial_logfp);
|
||||
@ -64,21 +72,50 @@ serial_log_command (cmd)
|
||||
fflush (serial_logfp);
|
||||
}
|
||||
|
||||
/* Define bogus char to represent a BREAK. Should be careful to choose a value
|
||||
that can't be confused with a normal char, or an error code. */
|
||||
#define SERIAL_BREAK 1235
|
||||
|
||||
static void
|
||||
serial_logchar (ch)
|
||||
serial_logchar (ch, timeout)
|
||||
int ch;
|
||||
int timeout;
|
||||
{
|
||||
if (serial_logbase != logbase_ascii)
|
||||
fputc_unfiltered (' ', serial_logfp);
|
||||
|
||||
switch (ch)
|
||||
{
|
||||
case '\\': fputs_unfiltered ("\\\\", serial_logfp); break;
|
||||
case '\b': fputs_unfiltered ("\\b", serial_logfp); break;
|
||||
case '\f': fputs_unfiltered ("\\f", serial_logfp); break;
|
||||
case '\n': fputs_unfiltered ("\\n", serial_logfp); break;
|
||||
case '\r': fputs_unfiltered ("\\r", serial_logfp); break;
|
||||
case '\t': fputs_unfiltered ("\\t", serial_logfp); break;
|
||||
case '\v': fputs_unfiltered ("\\v", serial_logfp); break;
|
||||
default: fprintf_unfiltered (serial_logfp, isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF); break;
|
||||
}
|
||||
case SERIAL_TIMEOUT:
|
||||
fprintf_unfiltered (serial_logfp, "<Timeout: %d seconds>", timeout);
|
||||
return;
|
||||
case SERIAL_ERROR:
|
||||
fprintf_unfiltered (serial_logfp, "<Error: %s>", safe_strerror (errno));
|
||||
return;
|
||||
case SERIAL_EOF:
|
||||
fputs_unfiltered ("<Eof>", serial_logfp);
|
||||
return;
|
||||
case SERIAL_BREAK:
|
||||
fputs_unfiltered ("<Break>", serial_logfp);
|
||||
return;
|
||||
default:
|
||||
if (serial_logbase == logbase_hex)
|
||||
fprintf_unfiltered (serial_logfp, "%02x", ch & 0xff);
|
||||
else if (serial_logbase == logbase_octal)
|
||||
fprintf_unfiltered (serial_logfp, "%03o", ch & 0xff);
|
||||
else
|
||||
switch (ch)
|
||||
{
|
||||
case '\\': fputs_unfiltered ("\\\\", serial_logfp); break;
|
||||
case '\b': fputs_unfiltered ("\\b", serial_logfp); break;
|
||||
case '\f': fputs_unfiltered ("\\f", serial_logfp); break;
|
||||
case '\n': fputs_unfiltered ("\\n", serial_logfp); break;
|
||||
case '\r': fputs_unfiltered ("\\r", serial_logfp); break;
|
||||
case '\t': fputs_unfiltered ("\\t", serial_logfp); break;
|
||||
case '\v': fputs_unfiltered ("\\v", serial_logfp); break;
|
||||
default: fprintf_unfiltered (serial_logfp, isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -98,13 +135,12 @@ serial_write (scb, str, len)
|
||||
}
|
||||
if (!serial_writing)
|
||||
{
|
||||
serial_logchar ('w');
|
||||
serial_logchar (' ');
|
||||
fputs_unfiltered ("w ", serial_logfp);
|
||||
serial_writing = 1;
|
||||
}
|
||||
for (count = 0; count < len; count++)
|
||||
{
|
||||
serial_logchar (str[count]);
|
||||
serial_logchar (str[count] & 0xff, 0);
|
||||
}
|
||||
/* Make sure that the log file is as up-to-date as possible,
|
||||
in case we are getting ready to dump core or something. */
|
||||
@ -130,11 +166,10 @@ serial_readchar (scb, timeout)
|
||||
}
|
||||
if (!serial_reading)
|
||||
{
|
||||
serial_logchar ('r');
|
||||
serial_logchar (' ');
|
||||
fputs_unfiltered ("r ", serial_logfp);
|
||||
serial_reading = 1;
|
||||
}
|
||||
serial_logchar (ch);
|
||||
serial_logchar (ch, timeout);
|
||||
/* Make sure that the log file is as up-to-date as possible,
|
||||
in case we are getting ready to dump core or something. */
|
||||
fflush (serial_logfp);
|
||||
@ -142,6 +177,30 @@ serial_readchar (scb, timeout)
|
||||
return (ch);
|
||||
}
|
||||
|
||||
int
|
||||
serial_send_break (scb)
|
||||
serial_t scb;
|
||||
{
|
||||
if (serial_logfp != NULL)
|
||||
{
|
||||
if (serial_reading)
|
||||
{
|
||||
fputc_unfiltered ('\n', serial_logfp);
|
||||
serial_reading = 0;
|
||||
}
|
||||
if (!serial_writing)
|
||||
{
|
||||
fputs_unfiltered ("w ", serial_logfp);
|
||||
serial_writing = 1;
|
||||
}
|
||||
serial_logchar (SERIAL_BREAK, 0);
|
||||
/* Make sure that the log file is as up-to-date as possible,
|
||||
in case we are getting ready to dump core or something. */
|
||||
fflush (serial_logfp);
|
||||
}
|
||||
return (scb -> ops -> send_break (scb));
|
||||
}
|
||||
|
||||
static struct serial_ops *
|
||||
serial_interface_lookup (name)
|
||||
char *name;
|
||||
@ -471,6 +530,8 @@ serial_printf (va_alist)
|
||||
void
|
||||
_initialize_serial ()
|
||||
{
|
||||
struct cmd_list_element *cmd;
|
||||
|
||||
#if 0
|
||||
add_com ("connect", class_obscure, connect_command,
|
||||
"Connect the terminal directly up to the command monitor.\n\
|
||||
@ -484,4 +545,10 @@ This file is used to record the remote session for future playback\n\
|
||||
by gdbserver.", &setlist),
|
||||
&showlist);
|
||||
|
||||
add_show_from_set (add_set_enum_cmd ("remotelogbase", no_class,
|
||||
logbase_enums,
|
||||
(char *)&serial_logbase,
|
||||
"Set ...",
|
||||
&setlist),
|
||||
&showlist);
|
||||
}
|
||||
|
@ -97,8 +97,9 @@ serial_t serial_fdopen PARAMS ((const int fd));
|
||||
|
||||
/* Send a break between 0.25 and 0.5 seconds long. */
|
||||
|
||||
#define SERIAL_SEND_BREAK(SERIAL_T) \
|
||||
((*(SERIAL_T)->ops->send_break) (SERIAL_T))
|
||||
extern int serial_send_break PARAMS ((serial_t scb));
|
||||
|
||||
#define SERIAL_SEND_BREAK(SERIAL_T) serial_send_break (SERIAL_T)
|
||||
|
||||
/* Turn the port into raw mode. */
|
||||
|
||||
@ -176,9 +177,6 @@ extern void serial_printf PARAMS ((serial_t desc, const char *, ...))
|
||||
|
||||
/* File in which to record the remote debugging session */
|
||||
|
||||
extern char *serial_logfile;
|
||||
extern FILE *serial_logfp;
|
||||
|
||||
extern void serial_log_command PARAMS ((const char *));
|
||||
|
||||
#endif /* SERIAL_H */
|
||||
|
@ -1171,7 +1171,6 @@ execute_command (p, from_tty)
|
||||
register enum language flang;
|
||||
static int warned = 0;
|
||||
/* FIXME: These should really be in an appropriate header file */
|
||||
extern FILE *serial_logfp;
|
||||
extern void serial_log_command PARAMS ((const char *));
|
||||
|
||||
free_all_values ();
|
||||
@ -1180,8 +1179,7 @@ execute_command (p, from_tty)
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
||||
if (serial_logfp != NULL)
|
||||
serial_log_command (p);
|
||||
serial_log_command (p);
|
||||
|
||||
while (*p == ' ' || *p == '\t') p++;
|
||||
if (*p)
|
||||
|
Loading…
Reference in New Issue
Block a user