Ticket #69642: patch-symfile-warnings-only-when-verbose.diff

File patch-symfile-warnings-only-when-verbose.diff, 3.2 KB (added by RJVB (René Bertin), 7 months ago)
  • machoread.c

    diff --git gdb/orig.machoread.c gdb/machoread.c
    index 49cf4fd..2f20b8c 100644
    old new macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd, 
    421421  asymbol **symp;
    422422  struct bfd_hash_table table;
    423423  int nbr_sections;
     424  const int should_print = (symfile_flags & SYMFILE_VERBOSE) && info_verbose;
    424425
    425426  /* Per section flag to mark which section have been rebased.  */
    426427  unsigned char *sections_rebased;
    macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd, 
    429430
    430431  if (!bfd_check_format (abfd.get (), bfd_object))
    431432    {
    432       warning (_("`%s': can't read symbols: %s."), oso->name,
     433      if (should_print) warning (_("`%s': can't read symbols: %s."), oso->name,
    433434               bfd_errmsg (bfd_get_error ()));
    434435      return;
    435436    }
    436437
    437438  if (abfd->my_archive == NULL && oso->mtime != bfd_get_mtime (abfd.get ()))
    438439    {
    439       warning (_("`%s': file time stamp mismatch."), oso->name);
     440      if (should_print) warning (_("`%s': file time stamp mismatch."), oso->name);
    440441      return;
    441442    }
    442443
    macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr, 
    602603{
    603604  int ix;
    604605  oso_el *oso;
     606  const int should_print = (symfile_flags & SYMFILE_VERBOSE) && info_verbose;
    605607
    606608  /* Sort oso by name so that files from libraries are gathered.  */
    607609  std::sort (oso_vector_ptr->begin (), oso_vector_ptr->end (),
    macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr, 
    636638                                                     gnutarget));
    637639          if (archive_bfd == NULL)
    638640            {
    639               warning (_("Could not open OSO archive file \"%s\""),
     641              if (should_print) warning (_("Could not open OSO archive file \"%s\""),
    640642                       archive_name.c_str ());
    641643              ix = last_ix;
    642644              continue;
    643645            }
    644646          if (!bfd_check_format (archive_bfd.get (), bfd_archive))
    645647            {
    646               warning (_("OSO archive file \"%s\" not an archive."),
     648              if (should_print) warning (_("OSO archive file \"%s\" not an archive."),
    647649                       archive_name.c_str ());
    648650              ix = last_ix;
    649651              continue;
    macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr, 
    654656
    655657          if (member_bfd == NULL)
    656658            {
    657               warning (_("Could not read archive members out of "
     659              if (should_print) warning (_("Could not read archive members out of "
    658660                         "OSO archive \"%s\""), archive_name.c_str ());
    659661              ix = last_ix;
    660662              continue;
    macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr, 
    691693            {
    692694              oso2 = &(*oso_vector_ptr)[ix2];
    693695
    694               if (oso2->name != NULL)
     696              if (oso2->name != NULL && should_print)
    695697                warning (_("Could not find specified archive member "
    696698                           "for OSO name \"%s\""), oso->name);
    697699            }
    macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr, 
    700702      else
    701703        {
    702704          gdb_bfd_ref_ptr abfd (gdb_bfd_open (oso->name, gnutarget));
    703           if (abfd == NULL)
    704             warning (_("`%s': can't open to read symbols: %s."), oso->name,
     705          if (abfd == NULL) {
     706            if (should_print) warning (_("`%s': can't open to read symbols: %s."), oso->name,
    705707                     bfd_errmsg (bfd_get_error ()));
    706           else
     708          } else
    707709            macho_add_oso_symfile (oso, abfd, oso->name, main_objfile,
    708710                                   symfile_flags);
    709711