Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: gdb-patches@sourceware.org, Doug Evans <dje@google.com>
Subject: Re: [RFA] Patch for incorrect handling of references to pointers 	[pr1147]
Date: Thu, 05 Jun 2008 20:38:00 -0000	[thread overview]
Message-ID: <20080605203748.GA3818@caradoc.them.org> (raw)
In-Reply-To: <8ac60eac0805081418md64f7bcha08664e9554e5750@mail.gmail.com>

On Thu, May 08, 2008 at 02:18:53PM -0700, Paul Pluzhnikov wrote:
> Greetings,
> 
> Attached patch fixes incorrect handling of "this" when reference
> to pointer is used:
>   http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view&database=gdb&pr=1147
> and adds a test case for it.

Since there's a PR, please mention it in the changelog and commit
message; it'll show up in gnats automatically.  Assuming we eventually
switch to bugzilla, the same thing will work there.  For instance:

2008-05-08  Paul Pluzhnikov  <ppluzhnikov@google.com>

	PR gdb/1147
	* valopts.c (find_overload_match): Handle references
	to pointers.

> --- gdb/testsuite/gdb.cp/call-c.exp.orig	2008-05-08 14:01:57.000000000 -0700
> +++ gdb/testsuite/gdb.cp/call-c.exp	2008-05-08 13:54:14.497857000 -0700
> @@ -44,3 +44,6 @@ gdb_load ${binfile}
>  runto_main
>  
>  gdb_test "print foo(1)" "\\\$$decimal = 1"
> +send_gdb "next\nnext\nnext\n"
> +gdb_expect -re "$gdb_prompt $"
> +gdb_test "print rf->func()" "\\\$$decimal = 1"

This is an unsafe use of send_gdb, because the gdb_expect might match
only the first of three expected prompts depending when there is a
pause in the output.  In general, relying on multiple nexts makes the
test case hard to modify; can you set a breakpoint and use
gdb_get_line_number to find the line to break on?
 
> --- gdb/valops.c.orig	2008-05-08 14:01:57.000000000 -0700
> +++ gdb/valops.c	2008-05-08 13:57:14.320875000 -0700
> @@ -1919,7 +1919,8 @@ find_overload_match (struct type **arg_t
>    if (objp)
>      {
>        if (TYPE_CODE (value_type (temp)) != TYPE_CODE_PTR
> -	  && TYPE_CODE (value_type (*objp)) == TYPE_CODE_PTR)
> +	  && (TYPE_CODE (value_type (*objp)) == TYPE_CODE_PTR
> +	      || (TYPE_CODE (value_type (*objp)) == TYPE_CODE_REF)))

One more set of parens on the last line than you need.

Sorry about the delay.

-- 
Daniel Jacobowitz
CodeSourcery


  parent reply	other threads:[~2008-06-05 20:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09  1:53 Paul Pluzhnikov
2008-05-17 13:58 ` Paul Pluzhnikov
2008-05-28  6:52   ` Paul Pluzhnikov
2008-06-05  1:19   ` Paul Pluzhnikov
2008-06-05 20:38 ` Daniel Jacobowitz [this message]
2008-06-06  0:52   ` Paul Pluzhnikov
2008-06-06  2:36     ` Daniel Jacobowitz
2008-06-06 18:32       ` Paul Pluzhnikov

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=20080605203748.GA3818@caradoc.them.org \
    --to=drow@false.org \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ppluzhnikov@google.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