Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] physname regression: Non-matching type false breakpoint
Date: Sun, 05 Jun 2011 15:34:00 -0000	[thread overview]
Message-ID: <20110605153419.GA14873@host1.jankratochvil.net> (raw)

Hi,

FSF GDB HEAD can now successfully break on a function which does not match the
specified type.

This is a physname regression.


Thanks,
Jan


gdb/
2011-06-05  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* linespec.c (find_method): Accept the function type automatically only
	if it was specified with parameter types.

gdb/testsuite/
2011-06-05  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.cp/paren-type.cc: New files.
	* gdb.cp/paren-type.exp: New files.

--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1732,7 +1732,10 @@ find_method (int funfirstline, struct linespec_result *canonical,
   i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr,
 		     file_symtab);
 
-  if (i1 == 1)
+  /* The strchr check is there if any types were specified verify the single
+     found found parameter types really match those specified by user in COPY.
+     */
+  if (i1 == 1 && strchr (copy, '(') == NULL)
     {
       /* There is exactly one field with that name.  */
       sym = sym_arr[0];
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/paren-type.cc
@@ -0,0 +1,33 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+class C
+{
+public:
+  static void f (short x);
+};
+
+void
+C::f (short x)
+{
+}
+
+int
+main ()
+{
+  C::f(1);
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/paren-type.exp
@@ -0,0 +1,24 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set testfile paren-type
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
+    return -1
+}
+
+gdb_test "break C::f(long)" {the class `C' does not have any method instance named f\(long\)}
+
+# Sanity check the breakpoints work for the correct type.
+gdb_test "break C::f(short)" "Breakpoint 1 at \[^\r\n\]*"


             reply	other threads:[~2011-06-05 15:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-05 15:34 Jan Kratochvil [this message]
2011-06-05 15:57 ` Mark Kettenis
2011-06-05 16:19   ` comments formatting [Re: [patch] physname regression: Non-matching type false breakpoint] Jan Kratochvil
2011-06-05 16:23     ` Andreas Schwab
2011-06-05 16:35       ` Jan Kratochvil
2011-06-05 16:50         ` Alfred M. Szmidt
2011-06-05 16:57           ` Jan Kratochvil
2011-06-05 17:15             ` Alfred M. Szmidt
2011-06-05 17:24               ` Jan Kratochvil
2011-06-05 22:25                 ` Alfred M. Szmidt
2011-06-05 17:49         ` Mark Kettenis
2011-06-06  9:22 ` [patch] physname regression: Non-matching type false breakpoint Pedro Alves
2011-06-06 21:20   ` Jan Kratochvil
2011-06-07 16:58     ` Pedro Alves
2011-07-01 20:29       ` [commit] " Jan Kratochvil

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=20110605153419.GA14873@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.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