diff options
author | Tristan Gingold <gingold@adacore.com> | 2009-12-15 09:41:16 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2009-12-15 09:41:16 +0000 |
commit | 65ccb1090e1acfd3bf8af44175c3f7b1b6377906 (patch) | |
tree | 790dd8afe136e1a37ca64f1a002350dfb0eefe70 | |
parent | 3188d986e975577c9dbfabe5ad05e0f873733a66 (diff) | |
download | gdb-65ccb1090e1acfd3bf8af44175c3f7b1b6377906.zip gdb-65ccb1090e1acfd3bf8af44175c3f7b1b6377906.tar.gz gdb-65ccb1090e1acfd3bf8af44175c3f7b1b6377906.tar.bz2 |
2009-12-15 Tristan Gingold <gingold@adacore.com>
* machoread.c (macho_check_dsym): Read uuid directly from load command
instead of from a fake section.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/machoread.c | 32 |
2 files changed, 13 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 122ead6..d73ddd3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2009-12-15 Tristan Gingold <gingold@adacore.com> + * machoread.c (macho_check_dsym): Read uuid directly from load command + instead of from a fake section. + +2009-12-15 Tristan Gingold <gingold@adacore.com> + * machoread.c (macho_symtab_read): Add comments. Always set first_offset. diff --git a/gdb/machoread.c b/gdb/machoread.c index e19e4e5..0194ee5 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -519,9 +519,8 @@ macho_check_dsym (struct objfile *objfile) size_t base_len = strlen (base_name); char *dsym_filename = alloca (name_len + dsym_len + base_len + 1); bfd *dsym_bfd; - asection *sect; - bfd_byte main_uuid[16]; - bfd_byte dsym_uuid[16]; + bfd_mach_o_load_command *main_uuid; + bfd_mach_o_load_command *dsym_uuid; strcpy (dsym_filename, objfile->name); strcpy (dsym_filename + name_len, DSYM_SUFFIX); @@ -530,19 +529,12 @@ macho_check_dsym (struct objfile *objfile) if (access (dsym_filename, R_OK) != 0) return NULL; - sect = bfd_get_section_by_name (objfile->obfd, "LC_UUID"); - if (sect == NULL) + if (bfd_mach_o_lookup_command (objfile->obfd, + BFD_MACH_O_LC_UUID, &main_uuid) == 0) { warning (_("can't find UUID in %s"), objfile->name); return NULL; } - if (!bfd_get_section_contents (objfile->obfd, sect, main_uuid, - 0, sizeof (main_uuid))) - { - warning (_("can't read UUID in %s"), objfile->name); - return NULL; - } - dsym_filename = xstrdup (dsym_filename); dsym_bfd = bfd_openr (dsym_filename, gnutarget); if (dsym_bfd == NULL) @@ -560,23 +552,16 @@ macho_check_dsym (struct objfile *objfile) return NULL; } - sect = bfd_get_section_by_name (dsym_bfd, "LC_UUID"); - if (sect == NULL) + if (bfd_mach_o_lookup_command (dsym_bfd, + BFD_MACH_O_LC_UUID, &dsym_uuid) == 0) { warning (_("can't find UUID in %s"), dsym_filename); bfd_close (dsym_bfd); xfree (dsym_filename); return NULL; } - if (!bfd_get_section_contents (dsym_bfd, sect, dsym_uuid, - 0, sizeof (dsym_uuid))) - { - warning (_("can't read UUID in %s"), dsym_filename); - bfd_close (dsym_bfd); - xfree (dsym_filename); - return NULL; - } - if (memcmp (dsym_uuid, main_uuid, sizeof (main_uuid))) + if (memcmp (dsym_uuid->command.uuid.uuid, main_uuid->command.uuid.uuid, + sizeof (main_uuid->command.uuid.uuid))) { warning (_("dsym file UUID doesn't match the one in %s"), objfile->name); bfd_close (dsym_bfd); @@ -584,7 +569,6 @@ macho_check_dsym (struct objfile *objfile) return NULL; } return dsym_bfd; - } static void |