Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Walfred Tedeschi <walfred.tedeschi@intel.com>
Cc: palves@redhat.com,  brobecker@adacore.com,  gdb-patches@sourceware.org
Subject: Re: [PATCH v1] Fix of default lookup for "this" symbol.
Date: Tue, 05 Apr 2016 11:32:00 -0000	[thread overview]
Message-ID: <86egaknvef.fsf@gmail.com> (raw)
In-Reply-To: <1457533925-22168-1-git-send-email-walfred.tedeschi@intel.com>	(Walfred Tedeschi's message of "Wed, 9 Mar 2016 15:32:05 +0100")

Walfred Tedeschi <walfred.tedeschi@intel.com> writes:

> 2016-03-09  Walfred Tedeschi  <walfred.tedeschi@intel.com>
>
> gdb/ChangeLog:
>
> 	* cp_lookup_bare_symbol (cp_lookup_bare_symbol): Add check for the

        * cp-namespace.c (cp_lookup_bare_symbol):

> 	name_of_this in order to return a null symbol when looking up
> 	for "this".
>
>
> ---
>  gdb/cp-namespace.c                         |  7 ++++++
>  gdb/testsuite/gdb.fortran/derived-type.exp | 35 ++++++++++++++++++++++++++++--
>  gdb/testsuite/gdb.fortran/derived-type.f90 |  7 +++++-
>  3 files changed, 46 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
> index 72002d6..b9d7dbe 100644
> --- a/gdb/cp-namespace.c
> +++ b/gdb/cp-namespace.c
> @@ -210,6 +210,13 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
>        if (lang_this.symbol == NULL)
>  	return null_block_symbol;
>  
> +      /* This whole routine is also the default path for several languages.
> +         In some languages "this" is not a special symbol,
> +         i.e. LA_NAME_OF_THIS is NULL.
> +         For those cases we should return a null_block_symbol.  */
> +      if (langdef != NULL && langdef->la_name_of_this == NULL)
> +	return null_block_symbol;
> +

The better fix would be pass "langdef" to lookup_language_this rather
than language_def (language_cplus).  The patch is like this:

--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -206,7 +206,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
       struct block_symbol lang_this;
       struct type *type;
 
-      lang_this = lookup_language_this (language_def (language_cplus), block);
+      lang_this = lookup_language_this (langdef, block);
       if (lang_this.symbol == NULL)
        return null_block_symbol;
 
>        type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
>        /* If TYPE_NAME is NULL, abandon trying to find this symbol.
>  	 This can happen for lambda functions compiled with clang++,
> diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp
> index f650352..acccf3b 100644
> --- a/gdb/testsuite/gdb.fortran/derived-type.exp
> +++ b/gdb/testsuite/gdb.fortran/derived-type.exp
> @@ -74,14 +74,45 @@ gdb_test_multiple $test $test {
>  gdb_test "print q%x%c" "\\$\[0-9\]+ = 1"
>  gdb_test "print q%x%d" "\\$\[0-9\]+ = 2\\.375"
>  
> +set result_line "= \\( a = 3.125, x = \\( c = 1, d = 2\\.375 \\),\
> +b = 'abcdefg' \\)\r\n$gdb_prompt $"
> +
> +# Used in case compiler generates an array of characters.
> +set result_line_2 " = \\( a = 3.125, x = \\( 1, 2\\.375 \\),\
> +b = \\('abcdefg'\\) \\)\r\n$gdb_prompt $"
> +
>  set test "print q"
>  gdb_test_multiple $test $test {
> -    -re "\\$\[0-9\]+ = \\( a = 3.125, x = \\( c = 1, d = 2\\.375 \\), b = 'abcdefg' \\)\r\n$gdb_prompt $" {

Your patch can't be applied cleanly, because the pattern in mainline is
"\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), 'abcdefg' \\)\r\n$gdb_prompt $", 
it doesn't have " a =" or "x = " things.

> +    -re $result_line {
>  	pass $test
>      }
> -    -re "\\$\[0-9\]+ = \\( a = 3.125, x = \\( 1, 2\\.375 \\), b = \\('abcdefg'\\) \\)\r\n$gdb_prompt $" {
> +    -re $result_line_2 {
>  	# Compiler should produce string, not an array of characters.
>  	setup_xfail "*-*-*"
>  	fail $test
>      }
>  }
> +

-- 
Yao (齐尧)


  reply	other threads:[~2016-04-05 11:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 14:32 Walfred Tedeschi
2016-04-05 11:32 ` Yao Qi [this message]
2016-06-20 14:17 [PATCH V1] " Walfred Tedeschi
2016-06-21  8:46 ` Yao Qi
2016-06-21  8:51   ` Tedeschi, Walfred

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=86egaknvef.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=walfred.tedeschi@intel.com \
    /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