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

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

On Thu, Jun 5, 2008 at 1:37 PM, Daniel Jacobowitz <drow@false.org> wrote:

> 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.

Thanks,

I believe to have fixed all the problems.
New patch attached.

-- 
Paul Pluzhnikov


ChangeLog:

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

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

testsuite/ChangeLog:

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

	* gdb.cp/call-c.exp: Test for incorrect handling of reference
	to pointer.
	* gdb.cp/call-c.cc: Likewise.

[-- Attachment #2: gdb-patch-1147-20080605.txt --]
[-- Type: text/plain, Size: 1691 bytes --]

ChangeLog:

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

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

testsuite/ChangeLog:

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

	* gdb.cp/call-c.exp: Test for incorrect handling of reference
	to pointer.
	* gdb.cp/call-c.cc: Likewise.

--- gdb/valops.c.orig	2008-06-05 13:53:24.000000000 -0700
+++ gdb/valops.c	2008-06-05 13:54:03.143468000 -0700
@@ -1972,7 +1972,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))
 	{
 	  temp = value_addr (temp);
 	}
--- gdb/testsuite/gdb.cp/call-c.cc.orig	2008-05-08 14:01:57.000000000 -0700
+++ gdb/testsuite/gdb.cp/call-c.cc	2008-06-05 17:30:09.009890000 -0700
@@ -21,7 +21,18 @@ int func(int x)
    return x;
 }
 
+struct Foo {
+  Foo() : x_(1) { }
+  int func() const { return x_; }
+ private:
+  int x_;
+};
+
 int main()
 {
+    Foo f;
+    Foo *pf = &f;
+    Foo* &rf = pf;
+    rf->func(); /* set breakpoint here */
     return func(0);
 }
--- gdb/testsuite/gdb.cp/call-c.exp.orig	2008-05-08 14:01:57.000000000 -0700
+++ gdb/testsuite/gdb.cp/call-c.exp	2008-06-05 17:31:19.700025000 -0700
@@ -43,4 +43,9 @@ gdb_load ${binfile}
 
 runto_main
 
+gdb_test "b [gdb_get_line_number {breakpoint here} ${testfile}.cc ]" \
+	 ".*Breakpoint .*call-c.*"
+
 gdb_test "print foo(1)" "\\\$$decimal = 1"
+gdb_test "continue" ".*breakpoint here.*" "continue to bp"
+gdb_test "print rf->func()" "\\\$$decimal = 1"

  reply	other threads:[~2008-06-06  0:52 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
2008-06-06  0:52   ` Paul Pluzhnikov [this message]
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=8ac60eac0806051752j5f15aa72r9574cfbc55f4ae98@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=dje@google.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