public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] qsort: syms.c stab sorting
Date: Sat, 19 Oct 2019 19:55:00 -0000	[thread overview]
Message-ID: <47f6ff2f9e679cd1f7af6fecbba5f62daf3bee95@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 47f6ff2f9e679cd1f7af6fecbba5f62daf3bee95 ***

commit 47f6ff2f9e679cd1f7af6fecbba5f62daf3bee95
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Mon Oct 14 13:53:40 2019 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Mon Oct 14 16:47:13 2019 +1030

    qsort: syms.c stab sorting
    
            * syms.c (struct indexentry): Add idx field.
            (cmpindexentry): Final sort on idx.
            (_bfd_stab_section_find_nearest_line): Set idx.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3593fa815a..a1eaef95d8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2019-10-14  Alan Modra  <amodra@gmail.com>
+
+	* syms.c (struct indexentry): Add idx field.
+	(cmpindexentry): Final sort on idx.
+	(_bfd_stab_section_find_nearest_line): Set idx.
+
 2019-10-14  Alan Modra  <amodra@gmail.com>
 
 	* dwarf2.c (struct lookup_funcinfo): Add idx field.
diff --git a/bfd/syms.c b/bfd/syms.c
index 9a2754ebe6..146f674a13 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -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.  */
@@ -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;


             reply	other threads:[~2019-10-19 19:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-19 19:55 gdb-buildbot [this message]
2019-10-19 19:55 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-10-19 21:23 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2019-10-19 22:14 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-10-27 14:11 ` Failures on Fedora-i686, " gdb-buildbot
2019-10-27 14:47 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-10-27 15:17 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-10-27 15:28 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-10-27 16:01 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-10-27 16:03 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47f6ff2f9e679cd1f7af6fecbba5f62daf3bee95@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).