aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparcl-tdep.c
diff options
context:
space:
mode:
authorMark Alexander <marka@cygnus>1998-10-28 16:08:02 +0000
committerMark Alexander <marka@cygnus>1998-10-28 16:08:02 +0000
commitc0351c0f6db37e3cf3263b7f1aa5f8ed6390cc5b (patch)
tree2073a4c28eed6325294a79a7977e45764025cd57 /gdb/sparcl-tdep.c
parentb9a9cde40b84c0c939b1f068befce7530393b4de (diff)
downloadgdb-c0351c0f6db37e3cf3263b7f1aa5f8ed6390cc5b.zip
gdb-c0351c0f6db37e3cf3263b7f1aa5f8ed6390cc5b.tar.gz
gdb-c0351c0f6db37e3cf3263b7f1aa5f8ed6390cc5b.tar.bz2
* sparcl-tdep.c (send_resp, sparclite_serial_start,
sparclite_serial_write): Use remote_timeout instead of hardcoded two second timeout. (download): Fix adjustment of a.out load addresses.
Diffstat (limited to 'gdb/sparcl-tdep.c')
-rw-r--r--gdb/sparcl-tdep.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c
index e50fdce..6c34938 100644
--- a/gdb/sparcl-tdep.c
+++ b/gdb/sparcl-tdep.c
@@ -355,7 +355,7 @@ send_resp (desc, c)
char c;
{
debug_serial_write (desc, &c, 1);
- return readchar (desc, 2);
+ return readchar (desc, remote_timeout);
}
static void
@@ -623,15 +623,42 @@ download (target_name, args, from_tty, write_routine, start_routine)
{
if (bfd_get_section_flags (pbfd, section) & SEC_LOAD)
{
- bfd_vma section_address;
+ bfd_vma section_address;
bfd_size_type section_size;
- file_ptr fptr;
+ file_ptr fptr;
+ const char *section_name;
+
+ section_name = bfd_get_section_name(pbfd, section);
section_address = bfd_get_section_vma (pbfd, section);
+
/* Adjust sections from a.out files, since they don't
carry their addresses with. */
if (bfd_get_flavour (pbfd) == bfd_target_aout_flavour)
- section_address += LOAD_ADDRESS;
+ {
+ if (strcmp (section_name, ".text") == 0)
+ section_address = bfd_get_start_address (pbfd);
+ else if (strcmp (section_name, ".data") == 0)
+ {
+ /* Read the first 8 bytes of the data section.
+ There should be the string 'DaTa' followed by
+ a word containing the actual section address. */
+ struct data_marker
+ {
+ char signature[4]; /* 'DaTa' */
+ unsigned char sdata[4]; /* &sdata */
+ } marker;
+ bfd_get_section_contents (pbfd, section, &marker, 0,
+ sizeof (marker));
+ if (strncmp (marker.signature, "DaTa", 4) == 0)
+ {
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ section_address = bfd_getb32 (marker.sdata);
+ else
+ section_address = bfd_getl32 (marker.sdata);
+ }
+ }
+ }
section_size = bfd_get_section_size_before_reloc (section);
@@ -691,7 +718,7 @@ sparclite_serial_start (entry)
store_unsigned_integer (buffer + 1, 4, entry);
debug_serial_write (remote_desc, buffer, 1 + 4);
- i = readchar (remote_desc, 2);
+ i = readchar (remote_desc, remote_timeout);
if (i != 0x55)
error ("Can't start SparcLite. Error code %d\n", i);
}
@@ -723,7 +750,7 @@ sparclite_serial_write (from_bfd, from_sec, from_addr, to_addr, len)
error ("Bad response from load command (0x%x)", i);
debug_serial_write (remote_desc, buffer, 4 + 4 + len);
- i = readchar (remote_desc, 2);
+ i = readchar (remote_desc, remote_timeout);
if (i != checksum)
error ("Bad checksum from load command (0x%x)", i);