aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-07-14 15:12:05 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-07-14 15:12:05 +0000
commit5af4f5f6f13163c6d9a516fc7cf7383d824d14b4 (patch)
treeb126a6a9fc89606345b6c1fb61b41425b2e7cb2b
parentb2eed00fa9d4dbee676d1f96dda1fce088eee5bf (diff)
downloadgdb-5af4f5f6f13163c6d9a516fc7cf7383d824d14b4.zip
gdb-5af4f5f6f13163c6d9a516fc7cf7383d824d14b4.tar.gz
gdb-5af4f5f6f13163c6d9a516fc7cf7383d824d14b4.tar.bz2
Tue Jul 13 14:03:48 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabsread.c (define_symbol): Make the caddr_t hack apply to `function returning foo' as well as `pointer to foo'. * remote.c [REMOTE_BREAKPOINT]: Use for breakpoint insn if defined. * config/m68k/tm-m68k.h: Define it. * mem-break.c, breakpoint.c: Improve comments. Tue Jul 13 13:35:31 1993 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr) * config/m68k/tm-dpx2.h: Replace "tm-68k.h" with "m68k/tm-m68k.h". * config/m68k/xm-dpx2.h: Define HAVE_TERMIOS not HAVE_TERMIO.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/breakpoint.c6
-rw-r--r--gdb/config/m68k/tm-dpx2.h2
-rw-r--r--gdb/config/m68k/tm-m68k.h5
-rw-r--r--gdb/config/m68k/xm-dpx2.h2
-rw-r--r--gdb/remote.c125
-rw-r--r--gdb/stabsread.c30
-rw-r--r--gdb/testsuite/ChangeLog5
8 files changed, 144 insertions, 45 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e5aee6b..ccdb725 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+Tue Jul 13 14:03:48 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * stabsread.c (define_symbol): Make the caddr_t hack apply to `function
+ returning foo' as well as `pointer to foo'.
+
+ * remote.c [REMOTE_BREAKPOINT]: Use for breakpoint insn if defined.
+ * config/m68k/tm-m68k.h: Define it.
+ * mem-break.c, breakpoint.c: Improve comments.
+
+Tue Jul 13 13:35:31 1993 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr)
+
+ * config/m68k/tm-dpx2.h: Replace "tm-68k.h" with "m68k/tm-m68k.h".
+ * config/m68k/xm-dpx2.h: Define HAVE_TERMIOS not HAVE_TERMIO.
+
Tue Jul 13 11:50:38 1993 Doug Evans (dje@canuck.cygnus.com)
* gdbcore.h (read_memory_integer, read_memory_unsigned_integer):
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 94cbcd7..1ed6abd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -347,7 +347,11 @@ read_memory_nobpt (memaddr, myaddr, len)
struct breakpoint *b;
if (memory_breakpoint_size < 0)
- /* No breakpoints on this machine. */
+ /* No breakpoints on this machine. FIXME: This should be
+ dependent on the debugging target. Probably want
+ target_insert_breakpoint to return a size, saying how many
+ bytes of the shadow contents are used, or perhaps have
+ something like target_xfer_shadow. */
return target_read_memory (memaddr, myaddr, len);
ALL_BREAKPOINTS (b)
diff --git a/gdb/config/m68k/tm-dpx2.h b/gdb/config/m68k/tm-dpx2.h
index 1483026..026723f 100644
--- a/gdb/config/m68k/tm-dpx2.h
+++ b/gdb/config/m68k/tm-dpx2.h
@@ -29,4 +29,4 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define FUNCTION_EPILOGUE_SIZE 4
#include <sys/types.h>
-#include "tm-68k.h"
+#include "m68k/tm-68k.h"
diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h
index f78fbce..c6d90db 100644
--- a/gdb/config/m68k/tm-m68k.h
+++ b/gdb/config/m68k/tm-m68k.h
@@ -65,6 +65,11 @@ read_memory_integer (read_register (SP_REGNUM), 4)
#define BREAKPOINT {0x4e, (0x40 | BPT_VECTOR)}
#endif
+/* We always use vector 1 for the "remote" target. This is hardcoded in
+ m68k-stub.c. */
+#define REMOTE_BPT_VECTOR 1
+#define REMOTE_BREAKPOINT {0x4e, (0x40 | REMOTE_BPT_VECTOR)}
+
/* If your kernel resets the pc after the trap happens you may need to
define this before including this file. */
diff --git a/gdb/config/m68k/xm-dpx2.h b/gdb/config/m68k/xm-dpx2.h
index f533cd9..60c0649 100644
--- a/gdb/config/m68k/xm-dpx2.h
+++ b/gdb/config/m68k/xm-dpx2.h
@@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER BIG_ENDIAN
-#define HAVE_TERMIO
+#define HAVE_TERMIOS
#define USG
/* Avoid redefinition errors */
diff --git a/gdb/remote.c b/gdb/remote.c
index c26be3b..806c60b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -113,61 +113,68 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Prototypes for local functions */
static void
-remote_write_bytes PARAMS ((CORE_ADDR, char *, int));
+remote_write_bytes PARAMS ((CORE_ADDR memaddr, char *myaddr, int len));
static void
-remote_read_bytes PARAMS ((CORE_ADDR, char *, int));
+remote_read_bytes PARAMS ((CORE_ADDR memaddr, char *myaddr, int len));
static void
-remote_files_info PARAMS ((struct target_ops *));
+remote_files_info PARAMS ((struct target_ops *ignore));
static int
-remote_xfer_memory PARAMS ((CORE_ADDR, char *, int, int, struct target_ops *));
+remote_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len,
+ int should_write, struct target_ops *target));
static void
remote_prepare_to_store PARAMS ((void));
static void
-remote_fetch_registers PARAMS ((int));
+remote_fetch_registers PARAMS ((int regno));
static void
-remote_resume PARAMS ((int, int));
+remote_resume PARAMS ((int step, int siggnal));
static int
-remote_start_remote PARAMS ((char *));
+remote_start_remote PARAMS ((char *dummy));
static void
-remote_open PARAMS ((char *, int));
+remote_open PARAMS ((char *name, int from_tty));
static void
-remote_close PARAMS ((int));
+remote_close PARAMS ((int quitting));
static void
-remote_store_registers PARAMS ((int));
+remote_store_registers PARAMS ((int regno));
static void
-getpkt PARAMS ((char *, int));
+getpkt PARAMS ((char *buf, int forever));
static void
-putpkt PARAMS ((char *));
+putpkt PARAMS ((char *buf));
static void
-remote_send PARAMS ((char *));
+remote_send PARAMS ((char *buf));
static int
readchar PARAMS ((void));
static int
-remote_wait PARAMS ((WAITTYPE *));
+remote_wait PARAMS ((WAITTYPE *status));
static int
-tohex PARAMS ((int));
+tohex PARAMS ((int nib));
static int
-fromhex PARAMS ((int));
+fromhex PARAMS ((int a));
static void
-remote_detach PARAMS ((char *, int));
+remote_detach PARAMS ((char *args, int from_tty));
+
+static void
+remote_interrupt PARAMS ((int signo));
+
+static void
+remote_interrupt_twice PARAMS ((int signo));
extern struct target_ops remote_ops; /* Forward decl */
@@ -360,13 +367,11 @@ remote_resume (step, siggnal)
putpkt (buf);
}
-static void remote_interrupt_twice PARAMS ((int));
-static void (*ofunc)();
-
/* Send ^C to target to halt it. Target will respond, and send us a
packet. */
-void remote_interrupt(signo)
+static void
+remote_interrupt (signo)
int signo;
{
/* If this doesn't work, try more severe steps. */
@@ -378,6 +383,8 @@ void remote_interrupt(signo)
SERIAL_WRITE (remote_desc, "\003", 1); /* Send a ^C */
}
+static void (*ofunc)();
+
/* The user typed ^C twice. */
static void
remote_interrupt_twice (signo)
@@ -435,11 +442,23 @@ remote_wait (status)
while (*p)
{
- regno = strtol (p, &p, 16); /* Read the register number */
+ unsigned char *p1;
- if (*p++ != ':'
- || regno >= NUM_REGS)
- error ("Remote sent bad register number %s", buf);
+ regno = strtol (p, &p1, 16); /* Read the register number */
+
+ if (p1 == p)
+ error ("Remote sent badly formed register number: %s\nPacket: '%s'\n",
+ p1, buf);
+
+ p = p1;
+
+ if (*p++ != ':')
+ error ("Malformed packet (missing colon): %s\nPacket: '%s'\n",
+ p, buf);
+
+ if (regno >= NUM_REGS)
+ error ("Remote sent bad register number %d: %s\nPacket: '%s'\n",
+ regno, p, buf);
for (i = 0; i < REGISTER_RAW_SIZE (regno); i++)
{
@@ -671,7 +690,7 @@ remote_xfer_memory(memaddr, myaddr, len, should_write, target)
static void
remote_files_info (ignore)
-struct target_ops *ignore;
+ struct target_ops *ignore;
{
puts_filtered ("Debugging a target over a serial line.\n");
}
@@ -1055,6 +1074,54 @@ remote_mourn ()
generic_mourn_inferior ();
}
+#ifdef REMOTE_BREAKPOINT
+
+/* On some machines, e.g. 68k, we may use a different breakpoint instruction
+ than other targets. */
+static unsigned char break_insn[] = REMOTE_BREAKPOINT;
+
+/* Check that it fits in BREAKPOINT_MAX bytes. */
+static unsigned char check_break_insn_size[BREAKPOINT_MAX] = REMOTE_BREAKPOINT;
+
+#else /* No REMOTE_BREAKPOINT. */
+
+/* Same old breakpoint instruction. This code does nothing different
+ than mem-break.c. */
+static unsigned char break_insn[] = BREAKPOINT;
+
+#endif /* No REMOTE_BREAKPOINT. */
+
+/* Insert a breakpoint on targets that don't have any better breakpoint
+ support. We read the contents of the target location and stash it,
+ then overwrite it with a breakpoint instruction. ADDR is the target
+ location in the target machine. CONTENTS_CACHE is a pointer to
+ memory allocated for saving the target contents. It is guaranteed
+ by the caller to be long enough to save sizeof BREAKPOINT bytes (this
+ is accomplished via BREAKPOINT_MAX). */
+
+int
+remote_insert_breakpoint (addr, contents_cache)
+ CORE_ADDR addr;
+ char *contents_cache;
+{
+ int val;
+
+ val = target_read_memory (addr, contents_cache, sizeof break_insn);
+
+ if (val == 0)
+ val = target_write_memory (addr, (char *)break_insn, sizeof break_insn);
+
+ return val;
+}
+
+int
+remote_remove_breakpoint (addr, contents_cache)
+ CORE_ADDR addr;
+ char *contents_cache;
+{
+ return target_write_memory (addr, contents_cache, sizeof break_insn);
+}
+
/* Define the target subroutine names */
struct target_ops remote_ops = {
@@ -1073,8 +1140,10 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", /* to_doc */
remote_prepare_to_store, /* to_prepare_to_store */
remote_xfer_memory, /* to_xfer_memory */
remote_files_info, /* to_files_info */
- NULL, /* to_insert_breakpoint */
- NULL, /* to_remove_breakpoint */
+
+ remote_insert_breakpoint, /* to_insert_breakpoint */
+ remote_remove_breakpoint, /* to_remove_breakpoint */
+
NULL, /* to_terminal_init */
NULL, /* to_terminal_inferior */
NULL, /* to_terminal_ours_for_output */
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 7e8f10a..a31427a 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1037,25 +1037,27 @@ define_symbol (valu, string, desc, type, objfile)
if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL)
{
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR)
+ if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+ || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
{
- /* If we are giving a name to a type such as "pointer
- to foo", we better not set the TYPE_NAME. If the
- program contains "typedef char *caddr_t;", we don't
- want all variables of type char * to print as
- caddr_t. This is not just a consequence of GDB's
- type management; PCC and GCC (at least through
- version 2.4) both output variables of either type
- char * or caddr_t with the type number defined in
- the 't' symbol for caddr_t. If a future compiler
- cleans this up it GDB is not ready for it yet, but
- if it becomes ready we somehow need to disable this
- check (without breaking the PCC/GCC2.4 case).
+ /* If we are giving a name to a type such as "pointer to
+ foo" or "function returning foo", we better not set
+ the TYPE_NAME. If the program contains "typedef char
+ *caddr_t;", we don't want all variables of type char
+ * to print as caddr_t. This is not just a
+ consequence of GDB's type management; PCC and GCC (at
+ least through version 2.4) both output variables of
+ either type char * or caddr_t with the type number
+ defined in the 't' symbol for caddr_t. If a future
+ compiler cleans this up it GDB is not ready for it
+ yet, but if it becomes ready we somehow need to
+ disable this check (without breaking the PCC/GCC2.4
+ case).
Sigh.
Fortunately, this check seems not to be necessary
- for anything except pointers. */
+ for anything except pointers or functions. */
}
else
TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 54d8772..8aa1c75 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jul 14 09:36:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * printcmds.exp: Change printf "%f\n" to printf "%f is fun" so
+ pattern does not match the command itself.
+
Mon Jul 12 11:22:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.t15/{gdbme.c,funcargs.exp}: Test for alloca-influenced frames.