aboutsummaryrefslogtreecommitdiff
path: root/bfd/vms-misc.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-01-27 16:43:27 +0000
committerTristan Gingold <gingold@adacore.com>2010-01-27 16:43:27 +0000
commit771deb084eb2128196b9057996847719583be713 (patch)
treef0d402367c16247a9ff912e537acc57e2119abf5 /bfd/vms-misc.c
parentb10d2873648b3629938afa9563fefb081b164c40 (diff)
downloadgdb-771deb084eb2128196b9057996847719583be713.zip
gdb-771deb084eb2128196b9057996847719583be713.tar.gz
gdb-771deb084eb2128196b9057996847719583be713.tar.bz2
2010-01-27 Tristan Gingold <gingold@adacore.com>
* vms.h: Remove trailing spaces. (struct hdr_struct): Remove unused hdr_c_cpr field. (enum file_format_enum): Add comments. * vms.c (vms_bfd_print_private_bfd_data): New function that replaces the macro. Remove trailing spaces. * vms-misc.c: Improve comments. (_bfd_vms_get_object_record): Also handle files without pads. * vms-hdr.c (_bfd_vms_write_dbg): Fix format string. * vms-gsd.c (struct flagdescstruct): Make name field const. (gsyflagdesc): Fix typo.
Diffstat (limited to 'bfd/vms-misc.c')
-rw-r--r--bfd/vms-misc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index 2181658..47e5985 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -211,7 +211,7 @@ _bfd_vms_get_header_values (bfd * abfd ATTRIBUTE_UNUSED,
can view and change the attributes of a file. Changing from
'variable length' to 'fixed length, 512 bytes' reveals the
record size at the first 2 bytes of every record. The same
- happens during the transfer of object files from VMS to Unix,
+ may happen during the transfer of object files from VMS to Unix,
at least with UCX, the DEC implementation of TCP/IP.
The VMS format repeats the size at bytes 2 & 3 of every record.
@@ -355,6 +355,8 @@ _bfd_vms_get_object_record (bfd *abfd)
test_len = 0;
else
{
+ int off = 0;
+
/* See _bfd_vms_get_first_record. */
test_len = 6;
@@ -366,10 +368,16 @@ _bfd_vms_get_object_record (bfd *abfd)
bfd_set_error (bfd_error_file_truncated);
return -1;
}
+ /* Alignment byte may be present or not. This is not easy to
+ detect but all object record types are not 0 (on Alpha VMS).
+ We also hope that pad byte is 0. */
+ if (PRIV (vms_buf)[0])
+ off = 1;
}
/* Read the record header */
- if (bfd_bread (PRIV (vms_buf), test_len, abfd) != test_len)
+ if (bfd_bread (PRIV (vms_buf) + off, test_len - off, abfd)
+ != test_len - off)
{
bfd_set_error (bfd_error_file_truncated);
return -1;