switch inferior/thread before calling target methods
[deliverable/binutils-gdb.git] / bfd / syms.c
index 9a2754ebe69e674c4c958b95f2251e1dc2dcf727..128cf191453c116732339c0461fcda19c6421a30 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic symbol-table support for the BFD library.
-   Copyright (C) 1990-2019 Free Software Foundation, Inc.
+   Copyright (C) 1990-2020 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -884,6 +884,7 @@ struct indexentry
   char *directory_name;
   char *file_name;
   char *function_name;
+  int idx;
 };
 
 /* Compare two indexentry structures.  This is called via qsort.  */
@@ -896,10 +897,9 @@ cmpindexentry (const void *a, const void *b)
 
   if (contestantA->val < contestantB->val)
     return -1;
-  else if (contestantA->val > contestantB->val)
+  if (contestantA->val > contestantB->val)
     return 1;
-  else
-    return 0;
+  return contestantA->idx - contestantB->idx;
 }
 
 /* A pointer to this structure is stored in *pinfo.  */
@@ -1078,19 +1078,21 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
              arelent *r;
              unsigned long val;
              asymbol *sym;
+             bfd_size_type octets;
 
              r = *pr;
              /* Ignore R_*_NONE relocs.  */
              if (r->howto->dst_mask == 0)
                continue;
 
+             octets = r->address * bfd_octets_per_byte (abfd, NULL);
              if (r->howto->rightshift != 0
                  || r->howto->size != 2
                  || r->howto->bitsize != 32
                  || r->howto->pc_relative
                  || r->howto->bitpos != 0
                  || r->howto->dst_mask != 0xffffffff
-                 || r->address * bfd_octets_per_byte (abfd) + 4 > stabsize)
+                 || octets + 4 > stabsize)
                {
                  _bfd_error_handler
                    (_("unsupported .stab relocation"));
@@ -1100,13 +1102,11 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
                  return FALSE;
                }
 
-             val = bfd_get_32 (abfd, info->stabs
-                               + r->address * bfd_octets_per_byte (abfd));
+             val = bfd_get_32 (abfd, info->stabs + octets);
              val &= r->howto->src_mask;
              sym = *r->sym_ptr_ptr;
              val += sym->value + sym->section->vma + r->addend;
-             bfd_put_32 (abfd, (bfd_vma) val, info->stabs
-                         + r->address * bfd_octets_per_byte (abfd));
+             bfd_put_32 (abfd, (bfd_vma) val, info->stabs + octets);
            }
        }
 
@@ -1198,6 +1198,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
                  info->indextable[i].directory_name = directory_name;
                  info->indextable[i].file_name = file_name;
                  info->indextable[i].function_name = NULL;
+                 info->indextable[i].idx = i;
                  ++i;
                }
 
@@ -1257,6 +1258,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
              info->indextable[i].directory_name = directory_name;
              info->indextable[i].file_name = file_name;
              info->indextable[i].function_name = function_name;
+             info->indextable[i].idx = i;
              ++i;
              break;
            }
@@ -1270,6 +1272,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
          info->indextable[i].directory_name = directory_name;
          info->indextable[i].file_name = file_name;
          info->indextable[i].function_name = NULL;
+         info->indextable[i].idx = i;
          ++i;
        }
 
@@ -1279,6 +1282,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
       info->indextable[i].directory_name = NULL;
       info->indextable[i].file_name = NULL;
       info->indextable[i].function_name = NULL;
+      info->indextable[i].idx = i;
       ++i;
 
       info->indextablesize = i;
This page took 0.025675 seconds and 4 git commands to generate.