public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior
@ 2011-10-28 13:46 rguenth at gcc dot gnu.org
  2011-10-28 15:34 ` [Bug gdb/13356] " pedro at codesourcery dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-28 13:46 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

             Bug #: 13356
           Summary: Be less strict about C++ overloading when calling
                    functions from the inferior
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: rguenth@gcc.gnu.org
    Classification: Unclassified


When debugging the C++ app

void foo (int *p) {}
int main() {}

gdb does not accept a constant as address

Temporary breakpoint 1, main () at t.C:2
2       int main() {}
(gdb) call foo(1)
Cannot resolve function foo to any overloaded instance

even though there is only a single possible overload candidate.

it's annoying to figure out and paste a cast to whatever specific
pointer type is required here when pasting an address from some
location.

gdb should be more forgiving than a C++ compiler here and do what I want.

Happens a lot to me when debugging gcc built with a C++ compiler.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug gdb/13356] Be less strict about C++ overloading when calling functions from the inferior
  2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
@ 2011-10-28 15:34 ` pedro at codesourcery dot com
  2011-10-28 15:37 ` pedro at codesourcery dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pedro at codesourcery dot com @ 2011-10-28 15:34 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

Pedro Alves <pedro at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |pedro at codesourcery dot
                   |                            |com
         Resolution|                            |DUPLICATE

--- Comment #1 from Pedro Alves <pedro at codesourcery dot com> 2011-10-28 15:33:08 UTC ---
> void foo (int *p) {}
...
> (gdb) call foo(1)
> Cannot resolve function foo to any overloaded instance

You're example passes 1, but I suspect you're not doing that in practice, but
instead, passing `0', like below, correct?

> (gdb) call foo (0)
> Cannot resolve function foo to any overloaded instance

This should work, as it is accepted by C++.  Allowing any other constant is of
quite dubious value.

This is also PR13225, which is already fixed in mainline.

*** This bug has been marked as a duplicate of bug 13225 ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug gdb/13356] Be less strict about C++ overloading when calling functions from the inferior
  2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
  2011-10-28 15:34 ` [Bug gdb/13356] " pedro at codesourcery dot com
@ 2011-10-28 15:37 ` pedro at codesourcery dot com
  2011-11-02  8:35 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pedro at codesourcery dot com @ 2011-10-28 15:37 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

Pedro Alves <pedro at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |

--- Comment #2 from Pedro Alves <pedro at codesourcery dot com> 2011-10-28 15:36:41 UTC ---
> it's annoying to figure out and paste a cast to whatever specific
> pointer type is required here when pasting an address from some
> location.

Bah, sorry I need to learn to read.

I'd be happier if gdb accepted (void*) instead of random integers though. 
Maybe this should be an option.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug gdb/13356] Be less strict about C++ overloading when calling functions from the inferior
  2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
  2011-10-28 15:34 ` [Bug gdb/13356] " pedro at codesourcery dot com
  2011-10-28 15:37 ` pedro at codesourcery dot com
@ 2011-11-02  8:35 ` rguenth at gcc dot gnu.org
  2012-08-15 11:58 ` rguenther at suse dot de
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-02  8:35 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-02 08:34:48 UTC ---
(In reply to comment #2)
> > it's annoying to figure out and paste a cast to whatever specific
> > pointer type is required here when pasting an address from some
> > location.
> 
> Bah, sorry I need to learn to read.
> 
> I'd be happier if gdb accepted (void*) instead of random integers though. 
> Maybe this should be an option.

Sure, (void *) would be an improvement, though taking literal integers
would be nice as well (if there is no integer overload).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug gdb/13356] Be less strict about C++ overloading when calling functions from the inferior
  2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-11-02  8:35 ` rguenth at gcc dot gnu.org
@ 2012-08-15 11:58 ` rguenther at suse dot de
  2012-08-17 17:37 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenther at suse dot de @ 2012-08-15 11:58 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

rguenther at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1
                 CC|                            |tromey at redhat dot com

--- Comment #4 from rguenther at suse dot de 2012-08-15 11:58:38 UTC ---
PING.  Now that GCC builds with a C++ compiler this starts to be _very_ _very_
annoying!

(gdb) call debug_tree (*expr_p)
 <integer_cst 0x7ffff695d7c0 type <integer_type 0x7ffff67fa5e8 int> constant 9>
(gdb) call debug_tree (0x7ffff67fa5e8)
Cannot resolve function debug_tree to any overloaded instance

bah!

(gdb) call debug_tree ((tree)0x7ffff67fa5e8)
 <integer_type 0x7ffff67fa5e8 int public SI
    size <integer_cst 0x7ffff6800100 type <integer_type 0x7ffff67fa0a8
bitsizetype> constant 32>
    unit size <integer_cst 0x7ffff6800120 type <integer_type 0x7ffff67fa000
sizetype> constant 4>
    align 32 symtab 0 alias set -1 canonical type 0x7ffff67fa5e8 precision 32
min <integer_cst 0x7ffff68000a0 -2147483648> max <integer_cst 0x7ffff68000c0
2147483647>
    pointer_to_this <pointer_type 0x7ffff68082a0>>

PLASE!

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug gdb/13356] Be less strict about C++ overloading when calling functions from the inferior
  2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-08-15 11:58 ` rguenther at suse dot de
@ 2012-08-17 17:37 ` cvs-commit at gcc dot gnu.org
  2012-08-17 17:40 ` keiths at redhat dot com
  2013-04-25 18:36 ` keiths at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-08-17 17:37 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-08-17 17:37:09 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    kseitz@sourceware.org    2012-08-17 17:37:03

Modified files:
    gdb            : ChangeLog gdbtypes.c gdbtypes.h language.h 
                     language.c ada-lang.c c-lang.c d-lang.c 
                     f-lang.c go-lang.c jv-lang.c m2-lang.c 
                     objc-lang.c opencl-lang.c p-lang.c 
    gdb/testsuite  : ChangeLog 
    gdb/doc        : ChangeLog gdb.texinfo 
    gdb/testsuite/gdb.base: default.exp help.exp setshow.exp 
    gdb/testsuite/gdb.cp: converts.exp converts.cc 

Log message:
    PR c++/13356
    * gdbtypes.c (strict_type_checking): New variable.
    (show_strict_type_checking): New function.
    (rank_one_type): Return NS_POINTER_INTEGER_CONVERSION_BADNESS
    if strict type checking is disabled.
    (_initialize_gdbtypes): Add "check type" subcommand.
    * gdbtypes.h (NS_INTEGER_POINTER_CONVERSION_BADNESS): New struct.

    PR c++/13356
    * gdb.base/default.exp: Update all "check type" tests.
    * gdb.base/help.exp: Likewise.
    * gdb.base/setshow.exp: Likewise.
    * gdb.cp/converts.cc (foo1_type_check): New function.
    (foo2_type_check): New function.
    (foo3_type_check): New function.
    (main): Call new functions.
    * converts.exp: Add tests for integer-to-pointer conversions
    with/without strict type-checking.

    PR c++/13356
    * gdb.texinfo (Type and Range Checking): Remove warning.
    Remove spurious commas.
    Update text and examples for re-implementation of set/show
    check type.
    (C and C++ Type and Range Checks): Likewise.

    * language.h (type_mode): Remove.
    (type_check): Remove.
    (struct language_defn): Remove la_type_check.
    (STRICT_TYPE): Remove unused macro.
    (type_error): Remove.
    * language.c (set_type_range_case): Renamed to ...
    (set_range_case): ... this.  Update all callers.
    Remove type_mode/type_check.
    (type_mode): Remove.
    (type_check): Remove.
    (show_type_command): Remove.
    (set_type_command): Remove.
    (language_info): Remove type checking output.
    (type_error): Remove unused function.
    (range_error): Update comment.
    (unknown_language_defn): Remove la_type_check.
    (auto_language_defn): Likewise.
    (local_language_defn): Likewise.
    (_initialize_language): Remove "check type" subcommand.
    * ada-lang.c (ada_language_defn): Remove la_type_check.
    * c-lang.c (c_language_defn): Likewise.
    (cplus_language_defn): Likewise.
    (asm_language_defn): Likewise.
    (minimal_language_defn): Likewise.
    * d-lang.c (d_language_defn): Likewise.
    * f-lang.c (f_language_defn): Likewise.
    * go-lang.c (go_language_defn): Likewise.
    * jv-lang.c (java_language_defn): Likewise.
    * m2-lang.c (m2_language_defn): Likewise.
    * objc-lang.c (objc_language_defn): Likewise.
    * opencl-lang.c (opencl_language_defn): Likewise.
    * p-lang.c (pascal_language_defn): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14599&r2=1.14600
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbtypes.c.diff?cvsroot=src&r1=1.240&r2=1.241
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbtypes.h.diff?cvsroot=src&r1=1.170&r2=1.171
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/language.h.diff?cvsroot=src&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/language.c.diff?cvsroot=src&r1=1.111&r2=1.112
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.373&r2=1.374
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/c-lang.c.diff?cvsroot=src&r1=1.101&r2=1.102
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/d-lang.c.diff?cvsroot=src&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/f-lang.c.diff?cvsroot=src&r1=1.74&r2=1.75
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/go-lang.c.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/jv-lang.c.diff?cvsroot=src&r1=1.103&r2=1.104
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/m2-lang.c.diff?cvsroot=src&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/objc-lang.c.diff?cvsroot=src&r1=1.106&r2=1.107
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/opencl-lang.c.diff?cvsroot=src&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/p-lang.c.diff?cvsroot=src&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3340&r2=1.3341
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/ChangeLog.diff?cvsroot=src&r1=1.1359&r2=1.1360
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/gdb.texinfo.diff?cvsroot=src&r1=1.1002&r2=1.1003
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/default.exp.diff?cvsroot=src&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/help.exp.diff?cvsroot=src&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/setshow.exp.diff?cvsroot=src&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/converts.exp.diff?cvsroot=src&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/converts.cc.diff?cvsroot=src&r1=1.3&r2=1.4

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug gdb/13356] Be less strict about C++ overloading when calling functions from the inferior
  2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-08-17 17:37 ` cvs-commit at gcc dot gnu.org
@ 2012-08-17 17:40 ` keiths at redhat dot com
  2013-04-25 18:36 ` keiths at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: keiths at redhat dot com @ 2012-08-17 17:40 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |keiths at redhat dot com
         Resolution|                            |FIXED
         AssignedTo|unassigned at sourceware    |keiths at redhat dot com
                   |dot org                     |
   Target Milestone|---                         |7.6

--- Comment #6 from Keith Seitz <keiths at redhat dot com> 2012-08-17 17:40:11 UTC ---
I have committed a patchset to fix this. [Note the patchset is large because it
contains a large cleanup of dead code.]

Please let me know if there are any further issues.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug gdb/13356] Be less strict about C++ overloading when calling functions from the inferior
  2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-08-17 17:40 ` keiths at redhat dot com
@ 2013-04-25 18:36 ` keiths at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: keiths at redhat dot com @ 2013-04-25 18:36 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13356

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |saurabh at hotmail dot com

--- Comment #7 from Keith Seitz <keiths at redhat dot com> 2013-04-25 18:36:35 UTC ---
*** Bug 15399 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-04-25 18:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-28 13:46 [Bug gdb/13356] New: Be less strict about C++ overloading when calling functions from the inferior rguenth at gcc dot gnu.org
2011-10-28 15:34 ` [Bug gdb/13356] " pedro at codesourcery dot com
2011-10-28 15:37 ` pedro at codesourcery dot com
2011-11-02  8:35 ` rguenth at gcc dot gnu.org
2012-08-15 11:58 ` rguenther at suse dot de
2012-08-17 17:37 ` cvs-commit at gcc dot gnu.org
2012-08-17 17:40 ` keiths at redhat dot com
2013-04-25 18:36 ` keiths at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).