* symfile.{c,h} (generic_load): New function.
remote{,-nindy,-eb,-mips}.c: Use it.
This commit is contained in:
parent
3b4cc5ecfb
commit
6b27ebe851
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Jun 8 11:08:29 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||||
|
|
||||||
|
* symfile.{c,h} (generic_load): New function.
|
||||||
|
remote{,-nindy,-eb,-mips}.c: Use it.
|
||||||
|
|
||||||
Mon Jun 7 20:07:30 1993 Stu Grossman (grossman@cygnus.com)
|
Mon Jun 7 20:07:30 1993 Stu Grossman (grossman@cygnus.com)
|
||||||
|
|
||||||
* Makefile.in (depend): More sed gubbish to deal with
|
* Makefile.in (depend): More sed gubbish to deal with
|
||||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "a29k/tm-a29k.h"
|
#include "a29k/tm-a29k.h"
|
||||||
|
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
#include "symfile.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -984,7 +985,7 @@ executable as it exists on the remote computer. For example,\n\
|
||||||
0, 0, /* Breakpoints */
|
0, 0, /* Breakpoints */
|
||||||
0, 0, 0, 0, 0, /* Terminal handling */
|
0, 0, 0, 0, 0, /* Terminal handling */
|
||||||
eb_kill,
|
eb_kill,
|
||||||
0, /* load */
|
generic_load, /* load */
|
||||||
0, /* lookup_symbol */
|
0, /* lookup_symbol */
|
||||||
eb_create_inferior,
|
eb_create_inferior,
|
||||||
eb_mourn_inferior,
|
eb_mourn_inferior,
|
||||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
#include "symfile.h"
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
|
@ -1232,74 +1233,6 @@ mips_kill ()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load an executable onto the board. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
mips_load (args, from_tty)
|
|
||||||
char *args;
|
|
||||||
int from_tty;
|
|
||||||
{
|
|
||||||
bfd *abfd;
|
|
||||||
asection *s;
|
|
||||||
int err;
|
|
||||||
CORE_ADDR text;
|
|
||||||
|
|
||||||
abfd = bfd_openr (args, 0);
|
|
||||||
if (abfd == (bfd *) NULL)
|
|
||||||
error ("Unable to open file %s", args);
|
|
||||||
|
|
||||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
|
||||||
error ("%s: Not an object file", args);
|
|
||||||
|
|
||||||
text = UINT_MAX;
|
|
||||||
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
|
|
||||||
{
|
|
||||||
if ((s->flags & SEC_LOAD) != 0)
|
|
||||||
{
|
|
||||||
bfd_size_type size;
|
|
||||||
|
|
||||||
size = bfd_get_section_size_before_reloc (s);
|
|
||||||
if (size > 0)
|
|
||||||
{
|
|
||||||
char *buffer;
|
|
||||||
struct cleanup *old_chain;
|
|
||||||
bfd_vma vma;
|
|
||||||
|
|
||||||
buffer = xmalloc (size);
|
|
||||||
old_chain = make_cleanup (free, buffer);
|
|
||||||
|
|
||||||
vma = bfd_get_section_vma (abfd, s);
|
|
||||||
printf_filtered ("Loading section %s, size 0x%x vma 0x%x\n",
|
|
||||||
bfd_get_section_name (abfd, s), size, vma);
|
|
||||||
bfd_get_section_contents (abfd, s, buffer, 0, size);
|
|
||||||
mips_xfer_memory (vma, buffer, size, 1, &mips_ops);
|
|
||||||
|
|
||||||
do_cleanups (old_chain);
|
|
||||||
|
|
||||||
if ((bfd_get_section_flags (abfd, s) & SEC_CODE) != 0
|
|
||||||
&& vma < text)
|
|
||||||
text = vma;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mips_request ('R', (unsigned int) mips_map_regno (PC_REGNUM),
|
|
||||||
(unsigned int) abfd->start_address,
|
|
||||||
&err);
|
|
||||||
if (err)
|
|
||||||
error ("Can't write PC register: %s", safe_strerror (errno));
|
|
||||||
|
|
||||||
bfd_close (abfd);
|
|
||||||
|
|
||||||
/* FIXME: Should we call symbol_file_add here? The local variable
|
|
||||||
text exists just for this call. Making the call seems to confuse
|
|
||||||
gdb if more than one file is loaded in. Perhaps passing MAINLINE
|
|
||||||
as 1 would fix this, but it's not clear that that is correct
|
|
||||||
either since it is possible to load several files onto the board.
|
|
||||||
|
|
||||||
symbol_file_add (args, from_tty, text, 0, 0, 0); */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start running on the target board. */
|
/* Start running on the target board. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1361,7 +1294,7 @@ Specify the serial device it is connected to (e.g., /dev/ttya).", /* to_doc */
|
||||||
NULL, /* to_terminal_ours */
|
NULL, /* to_terminal_ours */
|
||||||
NULL, /* to_terminal_info */
|
NULL, /* to_terminal_info */
|
||||||
mips_kill, /* to_kill */
|
mips_kill, /* to_kill */
|
||||||
mips_load, /* to_load */
|
generic_load, /* to_load */
|
||||||
NULL, /* to_lookup_symbol */
|
NULL, /* to_lookup_symbol */
|
||||||
mips_create_inferior, /* to_create_inferior */
|
mips_create_inferior, /* to_create_inferior */
|
||||||
mips_mourn_inferior, /* to_mourn_inferior */
|
mips_mourn_inferior, /* to_mourn_inferior */
|
||||||
|
|
|
@ -102,6 +102,7 @@ NINDY ROM monitor at the other end of the line.
|
||||||
|
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
#include "symfile.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
@ -271,57 +272,8 @@ nindy_files_info ()
|
||||||
nindy_initial_brk? " with initial break": "");
|
nindy_initial_brk? " with initial break": "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/* Return the number of characters in the buffer before
|
||||||
* remote_load:
|
the first DLE character. */
|
||||||
* Download an object file to the remote system by invoking the "comm960"
|
|
||||||
* utility. We look for "comm960" in $G960BIN, $G960BASE/bin, and
|
|
||||||
* DEFAULT_BASE/bin/HOST/bin where
|
|
||||||
* DEFAULT_BASE is defined in env.h, and
|
|
||||||
* HOST must be defined on the compiler invocation line.
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
nindy_load( filename, from_tty )
|
|
||||||
char *filename;
|
|
||||||
int from_tty;
|
|
||||||
{
|
|
||||||
asection *s;
|
|
||||||
/* Can't do unix style forking on a VMS system, so we'll use bfd to do
|
|
||||||
all the work for us
|
|
||||||
*/
|
|
||||||
|
|
||||||
bfd *file = bfd_openr(filename,0);
|
|
||||||
if (!file)
|
|
||||||
{
|
|
||||||
perror_with_name(filename);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bfd_check_format(file, bfd_object))
|
|
||||||
{
|
|
||||||
error("can't prove it's an object file\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( s = file->sections; s; s=s->next)
|
|
||||||
{
|
|
||||||
if (s->flags & SEC_LOAD)
|
|
||||||
{
|
|
||||||
char *buffer = xmalloc(s->_raw_size);
|
|
||||||
bfd_get_section_contents(file, s, buffer, 0, s->_raw_size);
|
|
||||||
printf("Loading section %s, size %x vma %x\n",
|
|
||||||
s->name,
|
|
||||||
s->_raw_size,
|
|
||||||
s->vma);
|
|
||||||
ninMemPut(s->vma, buffer, s->_raw_size);
|
|
||||||
free(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bfd_close(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the number of characters in the buffer before the first DLE character.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
|
@ -955,7 +907,7 @@ specified when you started GDB.",
|
||||||
0, 0, /* insert_breakpoint, remove_breakpoint, */
|
0, 0, /* insert_breakpoint, remove_breakpoint, */
|
||||||
0, 0, 0, 0, 0, /* Terminal crud */
|
0, 0, 0, 0, 0, /* Terminal crud */
|
||||||
nindy_kill,
|
nindy_kill,
|
||||||
nindy_load,
|
generic_load,
|
||||||
0, /* lookup_symbol */
|
0, /* lookup_symbol */
|
||||||
nindy_create_inferior,
|
nindy_create_inferior,
|
||||||
nindy_mourn_inferior,
|
nindy_mourn_inferior,
|
||||||
|
|
55
gdb/remote.c
55
gdb/remote.c
|
@ -76,6 +76,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
#include "symfile.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
@ -363,7 +364,7 @@ remote_interrupt_twice (signo)
|
||||||
signal (signo, ofunc);
|
signal (signo, ofunc);
|
||||||
|
|
||||||
target_terminal_ours ();
|
target_terminal_ours ();
|
||||||
if (query ("Interrupted while waiting for the inferior.\n\
|
if (query ("Interrupted while waiting for the program.\n\
|
||||||
Give up (and stop debugging it)? "))
|
Give up (and stop debugging it)? "))
|
||||||
{
|
{
|
||||||
target_mourn_inferior ();
|
target_mourn_inferior ();
|
||||||
|
@ -739,25 +740,41 @@ putpkt (buf)
|
||||||
|
|
||||||
/* Send it over and over until we get a positive ack. */
|
/* Send it over and over until we get a positive ack. */
|
||||||
|
|
||||||
do {
|
while (1)
|
||||||
|
{
|
||||||
if (kiodebug)
|
if (kiodebug)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
printf ("Sending packet: %s...", buf2); fflush(stdout);
|
printf ("Sending packet: %s...", buf2); fflush(stdout);
|
||||||
}
|
}
|
||||||
SERIAL_WRITE (remote_desc, buf2, p - buf2);
|
if (SERIAL_WRITE (remote_desc, buf2, p - buf2))
|
||||||
|
perror_with_name ("putpkt: write failed");
|
||||||
|
|
||||||
/* read until either a timeout occurs (-2) or '+' is read */
|
/* read until either a timeout occurs (-2) or '+' is read */
|
||||||
do {
|
while (1)
|
||||||
|
{
|
||||||
ch = readchar ();
|
ch = readchar ();
|
||||||
if (kiodebug) {
|
|
||||||
if (ch == '+')
|
switch (ch)
|
||||||
|
{
|
||||||
|
case '+':
|
||||||
|
if (kiodebug)
|
||||||
printf("Ack\n");
|
printf("Ack\n");
|
||||||
else
|
return;
|
||||||
printf ("%02X%c ", ch&0xFF, ch);
|
case SERIAL_TIMEOUT:
|
||||||
|
break; /* Retransmit buffer */
|
||||||
|
case SERIAL_ERROR:
|
||||||
|
perror_with_name ("putpkt: couldn't read ACK");
|
||||||
|
case SERIAL_EOF:
|
||||||
|
error ("putpkt: EOF while trying to read ACK");
|
||||||
|
default:
|
||||||
|
if (kiodebug)
|
||||||
|
printf ("%02X %c ", ch&0xFF, ch);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break; /* Here to retransmit */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while ((ch != '+') && (ch != SERIAL_TIMEOUT));
|
|
||||||
} while (ch != '+');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a packet from the remote machine, with error checking,
|
/* Read a packet from the remote machine, with error checking,
|
||||||
|
@ -782,15 +799,25 @@ getpkt (buf, forever)
|
||||||
/* This can loop forever if the remote side sends us characters
|
/* This can loop forever if the remote side sends us characters
|
||||||
continuously, but if it pauses, we'll get a zero from readchar
|
continuously, but if it pauses, we'll get a zero from readchar
|
||||||
because of timeout. Then we'll count that as a retry. */
|
because of timeout. Then we'll count that as a retry. */
|
||||||
while (c != '$')
|
|
||||||
if ((c = readchar()) == SERIAL_TIMEOUT)
|
c = readchar();
|
||||||
if (!forever)
|
if (c > 0 && c != '$')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (c == SERIAL_TIMEOUT)
|
||||||
{
|
{
|
||||||
|
if (forever)
|
||||||
|
continue;
|
||||||
if (++retries >= MAX_RETRIES)
|
if (++retries >= MAX_RETRIES)
|
||||||
if (kiodebug) puts_filtered ("Timed out.\n");
|
if (kiodebug) puts_filtered ("Timed out.\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c == SERIAL_EOF)
|
||||||
|
error ("Remote connection closed");
|
||||||
|
if (c == SERIAL_ERROR)
|
||||||
|
perror_with_name ("Remote communication error");
|
||||||
|
|
||||||
/* Force csum to be zero here because of possible error retry. */
|
/* Force csum to be zero here because of possible error retry. */
|
||||||
csum = 0;
|
csum = 0;
|
||||||
bp = buf;
|
bp = buf;
|
||||||
|
@ -1050,7 +1077,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", /* to_doc */
|
||||||
NULL, /* to_terminal_ours */
|
NULL, /* to_terminal_ours */
|
||||||
NULL, /* to_terminal_info */
|
NULL, /* to_terminal_info */
|
||||||
remote_kill, /* to_kill */
|
remote_kill, /* to_kill */
|
||||||
NULL, /* to_load */
|
generic_load, /* to_load */
|
||||||
NULL, /* to_lookup_symbol */
|
NULL, /* to_lookup_symbol */
|
||||||
NULL, /* to_create_inferior */
|
NULL, /* to_create_inferior */
|
||||||
remote_mourn, /* to_mourn_inferior */
|
remote_mourn, /* to_mourn_inferior */
|
||||||
|
|
Loading…
Reference in New Issue