From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH v2 3/8] Don't call decode_line_with_current_source from select_source_symtab
Date: Fri, 20 Sep 2019 19:20:00 -0000 [thread overview]
Message-ID: <20190920192017.15293-4-tromey@adacore.com> (raw)
In-Reply-To: <20190920192017.15293-1-tromey@adacore.com>
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.
2019-08-21 Tom Tromey <tromey@adacore.com>
* source.c (select_source_symtab): Don't call
decode_line_with_current_source.
---
gdb/ChangeLog | 5 +++++
gdb/source.c | 11 ++++-------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/gdb/source.c b/gdb/source.c
index 0171f2748b4..77eced31628 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -251,17 +251,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
--
2.20.1
next prev parent reply other threads:[~2019-09-20 19:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 19:20 [PATCH v2 0/8] Handle copy relocations and add $_ada_exception Tom Tromey
2019-09-20 19:20 ` [PATCH v2 2/8] Search global block from basic_lookup_symbol_nonlocal Tom Tromey
2019-09-21 4:32 ` Christian Biesinger via gdb-patches
2019-09-23 14:17 ` Andrew Burgess
2019-10-02 15:51 ` Tom Tromey
2019-11-09 6:54 ` Christian Biesinger via gdb-patches
2019-09-20 19:20 ` Tom Tromey [this message]
2019-09-20 19:20 ` [PATCH v2 6/8] Make print-file-var.exp test attribute visibility hidden, dlopen, and main symbol Tom Tromey
2019-09-23 14:52 ` Andrew Burgess
2019-10-01 14:11 ` Tom Tromey
2019-09-20 19:20 ` [PATCH v2 8/8] Add $_ada_exception convenience variable Tom Tromey
2019-09-20 19:20 ` [PATCH v2 7/8] Back out earlier Ada exception change Tom Tromey
2019-09-20 19:20 ` [PATCH v2 1/8] Change SYMBOL_VALUE_ADDRESS to be an rvalue Tom Tromey
2019-09-20 19:27 ` [PATCH v2 4/8] Make current_source_* per-program-space Tom Tromey
2019-09-20 19:27 ` [PATCH v2 5/8] Handle copy relocations Tom Tromey
2019-09-23 14:56 ` [PATCH v2 0/8] Handle copy relocations and add $_ada_exception Andrew Burgess
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=20190920192017.15293-4-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@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