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] Don't call decode_line_with_current_source from select_source_symtab
Date: Fri, 04 Oct 2019 01:02:00 -0000	[thread overview]
Message-ID: <5c281dbb2458be9d58355e865f527e96b40bcd8c@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 5c281dbb2458be9d58355e865f527e96b40bcd8c ***

commit 5c281dbb2458be9d58355e865f527e96b40bcd8c
Author:     Tom Tromey <tromey@adacore.com>
AuthorDate: Thu Aug 1 09:17:14 2019 -0600
Commit:     Tom Tromey <tromey@adacore.com>
CommitDate: Wed Oct 2 09:53:17 2019 -0600

    Don't call decode_line_with_current_source from select_source_symtab
    
    select_source_symtab currently calls decode_line_with_current_source.
    However, this function iterates over all program spaces, and so it is
    possible that it will return a "main" from some other program space.
    
    This patch changes select_source_symtab to simply use the symbol it
    already found in the current program space.
    
    gdb/ChangeLog
    2019-10-02  Tom Tromey  <tromey@adacore.com>
    
            * source.c (select_source_symtab): Don't call
            decode_line_with_current_source.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c2417cfd37..d419fdfdae 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-02  Tom Tromey  <tromey@adacore.com>
+
+	* source.c (select_source_symtab): Don't call
+	decode_line_with_current_source.
+
 2019-10-02  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* symtab.c (lookup_global_symbol): Search global block.
diff --git a/gdb/source.c b/gdb/source.c
index ff21818949..9222df1505 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -252,17 +252,14 @@ select_source_symtab (struct symtab *s)
 
   /* Make the default place to list be the function `main'
      if one exists.  */
-  if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0).symbol)
+  block_symbol bsym = lookup_symbol (main_name (), 0, VAR_DOMAIN, 0);
+  if (bsym.symbol != nullptr && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
     {
-      std::vector<symtab_and_line> sals
-	= decode_line_with_current_source (main_name (),
-					   DECODE_LINE_FUNFIRSTLINE);
-      const symtab_and_line &sal = sals[0];
+      symtab_and_line sal = find_function_start_sal (bsym.symbol, true);
       current_source_pspace = sal.pspace;
       current_source_symtab = sal.symtab;
       current_source_line = std::max (sal.line - (lines_to_list - 1), 1);
-      if (current_source_symtab)
-	return;
+      return;
     }
 
   /* Alright; find the last file in the symtab list (ignoring .h's


             reply	other threads:[~2019-10-04  1:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04  1:02 gdb-buildbot [this message]
2019-10-04  1:02 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2019-10-06 20:17 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-10-06 20:55 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-10-06 21:10 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-10-06 21:49 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " 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=5c281dbb2458be9d58355e865f527e96b40bcd8c@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).