[1/2] Allow expand_symtabs_matching to examine imported psymtabs

Message ID 20210324201510.23655-2-tom@tromey.com
State New
Headers show
Series
  • Two minor partial symtab cleanups
Related show

Commit Message

Tom Tromey March 24, 2021, 8:15 p.m.
Currently the psymtab variant of expand_symtabs_matching has this
check:

      /* We skip shared psymtabs because file-matching doesn't apply
	 to them; but we search them later in the loop.  */
      if (ps->user != NULL)
	continue;

In a larger series I'm working on, it's convenient to remove this
check.  And, I noticed that a similar check is not done for
expand_symtabs_with_fullname.  So, it made sense to me to remove the
check here as well.

gdb/ChangeLog
2021-03-24  Tom Tromey  <tom@tromey.com>

	* psymtab.c (psymbol_functions::expand_symtabs_matching): Remove
	"user" check.
---
 gdb/ChangeLog | 5 +++++
 gdb/psymtab.c | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.26.2

Comments

Keith Seitz via Gdb-patches March 25, 2021, 7:29 p.m. | #1
On 2021-03-24 4:15 p.m., Tom Tromey wrote:
> Currently the psymtab variant of expand_symtabs_matching has this

> check:

> 

>       /* We skip shared psymtabs because file-matching doesn't apply

> 	 to them; but we search them later in the loop.  */

>       if (ps->user != NULL)

> 	continue;

> 

> In a larger series I'm working on, it's convenient to remove this

> check.  And, I noticed that a similar check is not done for

> expand_symtabs_with_fullname.  So, it made sense to me to remove the

> check here as well.

> 

> gdb/ChangeLog

> 2021-03-24  Tom Tromey  <tom@tromey.com>

> 

> 	* psymtab.c (psymbol_functions::expand_symtabs_matching): Remove

> 	"user" check.

> ---

>  gdb/ChangeLog | 5 +++++

>  gdb/psymtab.c | 5 -----

>  2 files changed, 5 insertions(+), 5 deletions(-)

> 

> diff --git a/gdb/psymtab.c b/gdb/psymtab.c

> index 597817269c1..5a64166d983 100644

> --- a/gdb/psymtab.c

> +++ b/gdb/psymtab.c

> @@ -1313,11 +1313,6 @@ psymbol_functions::expand_symtabs_matching

>        if (ps->readin_p (objfile))

>  	continue;

>  

> -      /* We skip shared psymtabs because file-matching doesn't apply

> -	 to them; but we search them later in the loop.  */

> -      if (ps->user != NULL)

> -	continue;

> -

>        if (file_matcher)

>  	{

>  	  bool match;

> 


I'm not against this change, but I don't understand it.  It seems
logical to me to skip shared psymtabs, because we'll reach them through
some other psymtabs that include them.  So, both versions seem correct,
but maybe knowing why it's convenient to you would help.

Simon
Tom Tromey March 26, 2021, 6:17 p.m. | #2
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:


>> -      /* We skip shared psymtabs because file-matching doesn't apply

>> -	 to them; but we search them later in the loop.  */

>> -      if (ps->user != NULL)

>> -	continue;

>> -


Simon> I'm not against this change, but I don't understand it.  It seems
Simon> logical to me to skip shared psymtabs, because we'll reach them through
Simon> some other psymtabs that include them.  So, both versions seem correct,
Simon> but maybe knowing why it's convenient to you would help.

If the shared psymtab has a file name, then that file name will not be
checked by the file matcher.  This doesn't matter directly now because
file matching is often done via a different method, that does check
these.  However, with my proposed series to remove the redundant
methods, this issue is exposed.

Tom
Keith Seitz via Gdb-patches March 26, 2021, 6:27 p.m. | #3
On 2021-03-26 2:17 p.m., Tom Tromey wrote:>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
> 

>>> -      /* We skip shared psymtabs because file-matching doesn't apply

>>> -	 to them; but we search them later in the loop.  */

>>> -      if (ps->user != NULL)

>>> -	continue;

>>> -

> 

> Simon> I'm not against this change, but I don't understand it.  It seems

> Simon> logical to me to skip shared psymtabs, because we'll reach them through

> Simon> some other psymtabs that include them.  So, both versions seem correct,

> Simon> but maybe knowing why it's convenient to you would help.

> 

> If the shared psymtab has a file name, then that file name will not be

> checked by the file matcher.  This doesn't matter directly now because

> file matching is often done via a different method, that does check

> these.  However, with my proposed series to remove the redundant

> methods, this issue is exposed.


Ok, thanks.

Simon

Patch

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 597817269c1..5a64166d983 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1313,11 +1313,6 @@  psymbol_functions::expand_symtabs_matching
       if (ps->readin_p (objfile))
 	continue;
 
-      /* We skip shared psymtabs because file-matching doesn't apply
-	 to them; but we search them later in the loop.  */
-      if (ps->user != NULL)
-	continue;
-
       if (file_matcher)
 	{
 	  bool match;