+Sat Mar 19 08:51:12 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * Makefile.in (TAGS): Use variables directly, rather than using
+ find, to locate TM_FILE, XM_FILE, and NAT_FILE. This is faster
+ and means that these filenames no longer need be unique across all
+ the config/* directories.
+ * configure.in: Put the config/*/ into TM_FILE, etc.
+
+ * m68k-stub.c (computeSignal): Return SIGFPE, not SIGURG, for chk
+ and trapv exceptions.
+
+ * target.h (struct section_table), objfiles.h (struct obj_section):
+ Change name of field sec_ptr to the_bfd_section. More mnemonic
+ and avoids the (sort of, for the ptx compiler) name clash with
+ the name of the typedef.
+ * exec.c, xcoffexec.c, sparc-tdep.c, rs6000-nat.c, osfsolib.c,
+ solib.c, irix5-nat.c, objfiles.c, remote.c: Change users.
+
+ * utils.c: Include readline.h.
+ * Makefile.in (utils.o): Add dependency.
+
+ * remote.c (getpkt): Add support for run-length encoding.
+
Fri Mar 18 19:11:15 1994 Steve Chamberlain (sac@jonny.cygnus.com)
* utils.c (prompt_for_continue): Call readline, not gdb_readline.
# install-only is intended to address that need.
install: all install-only
install-only:
- transformed_name=`echo gdb | sed '$(program_transform_name)'` ; \
+ transformed_name=`t='$(program_transform_name)'; \
+ echo gdb | sed -e "s/brokensed/brokensed/" $$t` ; \
if test "x$$transformed_name" = x; then \
transformed_name=gdb ; \
else \
TAGS: $(TAGFILES_NO_SRCDIR) $(TAGFILES_WITH_SRCDIR)
@echo Making TAGS
- @etags `find $(srcdir)/config \( -name $(TM_FILE) \
- -o -name $(XM_FILE) \
- -o -name $(NAT_FILE) \) -print` \
+ @etags $(srcdir)/$(TM_FILE) \
+ $(srcdir)/$(XM_FILE) \
+ $(srcdir)/$(NAT_FILE) \
`(for i in $(DEPFILES) $(TAGFILES_NO_SRCDIR); do \
echo $(srcdir)/$$i ; \
done ; for i in $(TAGFILES_WITH_SRCDIR); do \
$(defs_h) $(gdbcore_h) $(inferior_h) target.h terminal.h
remote-utils.o: remote-utils.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
- $(inferior_h) $(remote_utils_h)
+ $(inferior_h) $(remote_utils_h)
remote.o: remote.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
$(inferior_h) $(remote_utils_h) symfile.h terminal.h
umax-xdep.o: umax-xdep.c $(defs_h) $(gdbcore_h) $(inferior_h)
utils.o: utils.c $(bfd_h) $(defs_h) $(expression_h) $(gdbcmd_h) \
- language.h signals.h target.h terminal.h
+ language.h signals.h target.h terminal.h $(readline_headers)
valarith.o: valarith.c $(bfd_h) $(defs_h) $(expression_h) \
$(gdbtypes_h) language.h $(symtab_h) target.h $(value_h)
< Makefile > Makefile.tem
mv -f Makefile.tem Makefile
fi
+
+sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
+/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
+/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
+mv -f Makefile.tmp Makefile
p -> addr += (CORE_ADDR) LM_ADDR (so);
p -> endaddr += (CORE_ADDR) LM_ADDR (so);
so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
- if (STREQ (p -> sec_ptr -> name, ".text"))
+ if (STREQ (p -> the_bfd_section -> name, ".text"))
{
so -> textsection = p;
}
return;
section.offset = 0;
section.objfile = objfile;
- section.sec_ptr = asect;
+ section.the_bfd_section = asect;
section.addr = bfd_section_vma (abfd, asect);
section.endaddr = section.addr + bfd_section_size (abfd, asect);
obstack_grow (&objfile->psymbol_obstack, §ion, sizeof(section));
addresses. */
CORE_ADDR offset;
- /* For the ptx compiler, we can't use the sec_ptr typedef when the field's
- name is sec_ptr. We really should rename the field (or better yet,
- the typedef should be bfd_sec_ptr). */
- struct sec *sec_ptr; /* BFD section pointer */
-
- /* Objfile this section is part of. Not currently used, but I'm sure
- that someone will want the bfd that the sec_ptr goes with or something
- like that before long. */
+ sec_ptr the_bfd_section; /* BFD section pointer */
+
+ /* Objfile this section is part of. */
struct objfile *objfile;
};
p -> addr += (CORE_ADDR) LM_ADDR (so);
p -> endaddr += (CORE_ADDR) LM_ADDR (so);
so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
- if (STREQ (p -> sec_ptr -> name, ".text"))
+ if (STREQ (p -> the_bfd_section -> name, ".text"))
{
so -> textsection = p;
}
/* Remote target communications for serial-line targets in custom GDB protocol
- Copyright 1988, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
This file is part of GDB.
we can extend the protocol and GDB
can tell whether the stub it is
talking to uses the old or the new.
-*/
+ search tAA:PP,MM Search backward starting at address
+ AA for a match with pattern PP and
+ mask MM. PP and MM are 4 bytes.
+ Not supported by all stubs.
+
+ Responses can be run-length encoded to save space. A '*' means that
+ the next two characters are hex digits giving a repeat count which
+ stands for that many repititions of the character preceding the '*'.
+ Note that this means that responses cannot contain '*'. Example:
+ "0*03" means the same as "0000". */
#include "defs.h"
#include <string.h>
remote_fetch_registers PARAMS ((int regno));
static void
-remote_resume PARAMS ((int pid, int step, int siggnal));
+remote_resume PARAMS ((int pid, int step, enum target_signal siggnal));
static int
remote_start_remote PARAMS ((char *dummy));
static int
readchar PARAMS ((void));
-static int
-remote_wait PARAMS ((int pid, WAITTYPE *status));
+static int remote_wait PARAMS ((int pid, struct target_waitstatus *status));
static int
tohex PARAMS ((int nib));
if (!remote_desc)
perror_with_name (name);
- if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
+ if (baud_rate != -1)
{
- SERIAL_CLOSE (remote_desc);
- perror_with_name (name);
+ if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
+ {
+ SERIAL_CLOSE (remote_desc);
+ perror_with_name (name);
+ }
}
SERIAL_RAW (remote_desc);
static void
remote_resume (pid, step, siggnal)
- int pid, step, siggnal;
+ int pid, step;
+ enum target_signal siggnal;
{
char buf[PBUFSIZ];
{
char *name;
target_terminal_ours_for_output ();
- printf_filtered ("Can't send signals to a remote system. ");
- name = strsigno (siggnal);
- if (name)
- printf_filtered (name);
- else
- printf_filtered ("Signal %d", siggnal);
- printf_filtered (" not sent.\n");
+ printf_filtered
+ ("Can't send signals to a remote system. %s not sent.\n",
+ target_signal_to_name (siggnal));
target_terminal_inferior ();
}
static int
remote_wait (pid, status)
int pid;
- WAITTYPE *status;
+ struct target_waitstatus *status;
{
unsigned char buf[PBUFSIZ];
- WSETEXIT ((*status), 0);
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = 0;
while (1)
{
{
flagword flags;
- flags = bfd_get_section_flags (abfd, s->sec_ptr);
+ flags = bfd_get_section_flags (abfd, s->the_bfd_section);
if (flags & SEC_CODE)
{
else if (buf[0] == 'W')
{
/* The remote process exited. */
- WSETEXIT (*status, (fromhex (buf[1]) << 4) + fromhex (buf[2]));
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = (fromhex (buf[1]) << 4) + fromhex (buf[2]);
return 0;
}
else if (buf[0] == 'S')
warning ("Invalid remote reply: %s", buf);
}
- WSETSTOP ((*status), (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))));
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = (enum target_signal)
+ (((fromhex (buf[1])) << 4) + (fromhex (buf[2])));
return 0;
}
xfersize = len;
if (should_write)
- bytes_xferred = remote_write_bytes (memaddr, myaddr, xfersize);
+ bytes_xferred = remote_write_bytes (memaddr,
+ (unsigned char *)myaddr, xfersize);
else
- bytes_xferred = remote_read_bytes (memaddr, myaddr, xfersize);
+ bytes_xferred = remote_read_bytes (memaddr,
+ (unsigned char *)myaddr, xfersize);
/* If we get an error, we are done xferring. */
if (bytes_xferred == 0)
return total_xferred;
}
+#if 0
+/* Enable after 4.12. */
+
+void
+remote_search (len, data, mask, startaddr, increment, lorange, hirange
+ addr_found, data_found)
+ int len;
+ char *data;
+ char *mask;
+ CORE_ADDR startaddr;
+ int increment;
+ CORE_ADDR lorange;
+ CORE_ADDR hirange;
+ CORE_ADDR *addr_found;
+ char *data_found;
+{
+ if (increment == -4 && len == 4)
+ {
+ long mask_long, data_long;
+ long data_found_long;
+ CORE_ADDR addr_we_found;
+ char buf[PBUFSIZ];
+ long returned_long[2];
+ char *p;
+
+ mask_long = extract_unsigned_integer (mask, len);
+ data_long = extract_unsigned_integer (data, len);
+ sprintf (buf, "t%x:%x,%x", startaddr, data_long, mask_long);
+ putpkt (buf);
+ getpkt (buf, 0);
+ if (buf[0] == '\0')
+ {
+ /* The stub doesn't support the 't' request. We might want to
+ remember this fact, but on the other hand the stub could be
+ switched on us. Maybe we should remember it only until
+ the next "target remote". */
+ generic_search (len, data, mask, startaddr, increment, lorange,
+ hirange, addr_found, data_found);
+ return;
+ }
+
+ if (buf[0] == 'E')
+ /* There is no correspondance between what the remote protocol uses
+ for errors and errno codes. We would like a cleaner way of
+ representing errors (big enough to include errno codes, bfd_error
+ codes, and others). But for now just use EIO. */
+ memory_error (EIO, startaddr);
+ p = buf;
+ addr_we_found = 0;
+ while (*p != '\0' && *p != ',')
+ addr_we_found = (addr_we_found << 4) + fromhex (*p++);
+ if (*p == '\0')
+ error ("Protocol error: short return for search");
+
+ data_found_long = 0;
+ while (*p != '\0' && *p != ',')
+ data_found_long = (data_found_long << 4) + fromhex (*p++);
+ /* Ignore anything after this comma, for future extensions. */
+
+ if (addr_we_found < lorange || addr_we_found >= hirange)
+ {
+ *addr_found = 0;
+ return;
+ }
+
+ *addr_found = addr_we_found;
+ *data_found = store_unsigned_integer (data_we_found, len);
+ return;
+ }
+ generic_search (len, data, mask, startaddr, increment, lorange,
+ hirange, addr_found, data_found);
+}
+#endif /* 0 */
+\f
static void
remote_files_info (ignore)
struct target_ops *ignore;
break; /* Here to retransmit */
}
+#if 0
+ /* This is wrong. If doing a long backtrace, the user should be
+ able to get out next time we call QUIT, without anything as violent
+ as interrupt_query. If we want to provide a way out of here
+ without getting to the next QUIT, it should be based on hitting
+ ^C twice as in remote_wait. */
if (quit_flag)
{
quit_flag = 0;
interrupt_query ();
}
+#endif
}
}
while the target is executing user code. */
static void
-getpkt (buf, forever)
- char *buf;
+getpkt (retbuf, forever)
+ char *retbuf;
int forever;
{
char *bp;
int c = 0;
unsigned char c1, c2;
int retries = 0;
+ char buf[PBUFSIZ];
+
#define MAX_RETRIES 10
while (1)
{
+#if 0
+ /* This is wrong. If doing a long backtrace, the user should be
+ able to get out time next we call QUIT, without anything as violent
+ as interrupt_query. If we want to provide a way out of here
+ without getting to the next QUIT, it should be based on hitting
+ ^C twice as in remote_wait. */
if (quit_flag)
{
quit_flag = 0;
interrupt_query ();
}
+#endif
/* This can loop forever if the remote side sends us characters
continuously, but if it pauses, we'll get a zero from readchar
}
}
-out:
+ /* Deal with run-length encoding. */
+ {
+ char *src = buf;
+ char *dest = retbuf;
+ int i;
+ int repeat;
+ do {
+ if (*src == '*')
+ {
+ if (src[1] == '\0' || src[2] == '\0')
+ {
+ if (remote_debug)
+ puts_filtered ("Packet too short, retrying\n");
+ goto whole;
+ }
+ repeat = (fromhex (src[1]) << 4) + fromhex (src[2]);
+ for (i = 0; i < repeat; ++i)
+ {
+ *dest++ = src[-1];
+ }
+ src += 2;
+ }
+ else
+ {
+ *dest++ = *src;
+ }
+ } while (*src++ != '\0');
+ }
+out:
SERIAL_WRITE (remote_desc, "+", 1);
if (remote_debug)
struct obj_section *s;
for (s = objfile->sections; s < objfile->sections_end; ++s)
{
- if (s->sec_ptr->target_index == textsec->target_index)
+ if (s->the_bfd_section->target_index == textsec->target_index)
{
s->addr += text_delta;
s->endaddr += text_delta;
}
- else if (s->sec_ptr->target_index == datasec->target_index)
+ else if (s->the_bfd_section->target_index == datasec->target_index)
{
s->addr += data_delta;
s->endaddr += data_delta;
}
- else if (s->sec_ptr->target_index == bsssec->target_index)
+ else if (s->the_bfd_section->target_index == bsssec->target_index)
{
s->addr += bss_delta;
s->endaddr += bss_delta;
for (i=0; &exec_ops.to_sections[i] < exec_ops.to_sections_end; i++)
{
- if (STREQ(".text", exec_ops.to_sections[i].sec_ptr->name))
+ if (STREQ(".text", exec_ops.to_sections[i].the_bfd_section->name))
{
exec_ops.to_sections[i].addr += vmap->tstart;
exec_ops.to_sections[i].endaddr += vmap->tstart;
}
- else if (STREQ(".data", exec_ops.to_sections[i].sec_ptr->name))
+ else if (STREQ(".data", exec_ops.to_sections[i].the_bfd_section->name))
{
exec_ops.to_sections[i].addr += vmap->dstart;
exec_ops.to_sections[i].endaddr += vmap->dstart;
and if vp->tstart is 0xd0002000, then the first byte of
the text section on disk corresponds to address 0xd0002200. */
stp->bfd = vp->bfd;
- stp->sec_ptr = bfd_get_section_by_name (stp->bfd, ".text");
- stp->addr = bfd_section_vma (stp->bfd, stp->sec_ptr) + vp->tstart;
- stp->endaddr = bfd_section_vma (stp->bfd, stp->sec_ptr) + vp->tend;
+ stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".text");
+ stp->addr = bfd_section_vma (stp->bfd, stp->the_bfd_section) + vp->tstart;
+ stp->endaddr = bfd_section_vma (stp->bfd, stp->the_bfd_section) + vp->tend;
stp++;
stp->bfd = vp->bfd;
- stp->sec_ptr = bfd_get_section_by_name (stp->bfd, ".data");
- stp->addr = bfd_section_vma (stp->bfd, stp->sec_ptr) + vp->dstart;
- stp->endaddr = bfd_section_vma (stp->bfd, stp->sec_ptr) + vp->dend;
+ stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".data");
+ stp->addr = bfd_section_vma (stp->bfd, stp->the_bfd_section) + vp->dstart;
+ stp->endaddr = bfd_section_vma (stp->bfd, stp->the_bfd_section) + vp->dend;
}
vmap_symtab (vp);
/* Target-dependent code for the SPARC for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
+ Free Software Foundation, Inc.
This file is part of GDB.
CORE_ADDR sigcontext_addr;
char scbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+ int saved_pc_offset = SIGCONTEXT_PC_OFFSET;
+ char *name = NULL;
+
+ /* Solaris2 ucbsigvechandler passes a pointer to a sigcontext
+ as the third parameter. The offset to the saved pc is 12. */
+ find_pc_partial_function (frame->pc, &name,
+ (CORE_ADDR *)NULL,(CORE_ADDR *)NULL);
+ if (name && STREQ (name, "ucbsigvechandler"))
+ saved_pc_offset = 12;
/* The sigcontext address is contained in register O2. */
get_saved_register (buf, (int *)NULL, (CORE_ADDR *)NULL,
/* Don't cause a memory_error when accessing sigcontext in case the
stack layout has changed or the stack is corrupt. */
- target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET,
+ target_read_memory (sigcontext_addr + saved_pc_offset,
scbuf, sizeof (scbuf));
return extract_address (scbuf, sizeof (scbuf));
}
s = find_pc_section(pc);
retval = (s != NULL
- && s->sec_ptr->name != NULL
- && STREQ (s->sec_ptr->name, ".plt"));
+ && s->the_bfd_section->name != NULL
+ && STREQ (s->the_bfd_section->name, ".plt"));
return(retval);
}
if (0 == bfd_section_size (abfd, asect))
return;
(*table_pp)->bfd = abfd;
- (*table_pp)->sec_ptr = asect;
+ (*table_pp)->the_bfd_section = asect;
(*table_pp)->addr = bfd_section_vma (abfd, asect);
(*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (abfd, asect);
(*table_pp)++;
if (p->endaddr >= memend)
{
/* Entire transfer is within this section. */
- res = xfer_fn (p->bfd, p->sec_ptr, myaddr, memaddr - p->addr, len);
+ res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, memaddr - p->addr, len);
return (res != false)? len: 0;
}
else if (p->endaddr <= memaddr)
{
/* This section overlaps the transfer. Just do half. */
len = p->endaddr - memaddr;
- res = xfer_fn (p->bfd, p->sec_ptr, myaddr, memaddr - p->addr, len);
+ res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, memaddr - p->addr, len);
return (res != false)? len: 0;
}
else if (p->addr < nextsectaddr)
local_hex_string_custom ((unsigned long) p->endaddr, "08l"));
if (info_verbose)
printf_filtered (" @ %s",
- local_hex_string_custom ((unsigned long) p->sec_ptr->filepos, "08l"));
- printf_filtered (" is %s", bfd_section_name (p->bfd, p->sec_ptr));
+ local_hex_string_custom ((unsigned long) p->the_bfd_section->filepos, "08l"));
+ printf_filtered (" is %s", bfd_section_name (p->bfd, p->the_bfd_section));
if (p->bfd != abfd) {
printf_filtered (" in %s", bfd_get_filename (p->bfd));
}
secaddr = parse_and_eval_address (args);
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++) {
- if (!strncmp (secname, bfd_section_name (exec_bfd, p->sec_ptr), seclen)
- && bfd_section_name (exec_bfd, p->sec_ptr)[seclen] == '\0') {
+ if (!strncmp (secname, bfd_section_name (exec_bfd, p->the_bfd_section), seclen)
+ && bfd_section_name (exec_bfd, p->the_bfd_section)[seclen] == '\0') {
offset = secaddr - p->addr;
p->addr += offset;
p->endaddr += offset;