public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
@ 2012-07-14 13:30 marco.trevisan at canonical dot com
2012-07-14 13:35 ` [Bug c++/14365] " marco.trevisan at canonical dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: marco.trevisan at canonical dot com @ 2012-07-14 13:30 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
Bug #: 14365
Summary: gdb crashes when checking ctor of lambdas (in
is_ctor_or_dtor)
Product: gdb
Version: 7.4
Status: NEW
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned@sourceware.org
ReportedBy: marco.trevisan@canonical.com
Classification: Unclassified
Created attachment 6531
--> http://sourceware.org/bugzilla/attachment.cgi?id=6531
gdb-fix-crash-when-checking-for-ctor-of-lambda by Thomas Voß
Using GDB to debug this test case: http://pastebin.ubuntu.com/1062024/ causes
it to crash in is_ctor_or_dtor.
Attached here patch by Thomas Voß that fixes it.
This is description:
«It turns out that gdb crashes as it tries to determine whether a field of a
lambda is a or ctor/dtor, given the fields name. Apparently, the field's name
is NULL and I added a check for that, bailing out and returning 0 ("no, this is
neither a dtor nor a ctor"). GDB behaves normally when being run on the test
program mentioned before. Patch is attached, generated with quilt.»
See launchpad bug http://pad.lv/1006860 for reference.
--
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 c++/14365] gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
@ 2012-07-14 13:35 ` marco.trevisan at canonical dot com
2012-07-15 12:55 ` jan.kratochvil at redhat dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marco.trevisan at canonical dot com @ 2012-07-14 13:35 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
Marco Trevisan <marco.trevisan at canonical dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://bugs.launchpad.net/
| |ubuntu/+source/gdb/+bug/100
| |6860
CC| |marco.trevisan at canonical
| |dot com
--
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 c++/14365] gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
2012-07-14 13:35 ` [Bug c++/14365] " marco.trevisan at canonical dot com
@ 2012-07-15 12:55 ` jan.kratochvil at redhat dot com
2012-08-01 18:55 ` tromey at redhat dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-07-15 12:55 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
Jan Kratochvil <jan.kratochvil at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jan.kratochvil at redhat
| |dot com
--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-07-15 12:55:24 UTC ---
Please post any patches to gdb-patches at sourceware.org.
--
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 c++/14365] gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
2012-07-14 13:35 ` [Bug c++/14365] " marco.trevisan at canonical dot com
2012-07-15 12:55 ` jan.kratochvil at redhat dot com
@ 2012-08-01 18:55 ` tromey at redhat dot com
2012-08-01 18:58 ` tromey at redhat dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at redhat dot com @ 2012-08-01 18:55 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
Tom Tromey <tromey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at redhat dot com
--- Comment #2 from Tom Tromey <tromey at redhat dot com> 2012-08-01 18:55:14 UTC ---
I reproduced the bug.
I don't think this is the correct fix.
What seems to be happening here is that we are trying to
compute the physname for a type that is a pointer to a member
function of an unnamed structure type.
Because it is unnamed, c_type_print_base falls through to
printing the body of the structure, instead of its name.
This then crashes.
Maybe NULL checks in is_constructor_name and is_destructor_name
would be ok; though I am not sure. But even if those were there
we would still be seeing very weird results here.
--
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 c++/14365] gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
` (2 preceding siblings ...)
2012-08-01 18:55 ` tromey at redhat dot com
@ 2012-08-01 18:58 ` tromey at redhat dot com
2012-08-03 17:22 ` keiths at redhat dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at redhat dot com @ 2012-08-01 18:58 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2012-08-01 18:57:50 UTC ---
BTW I reproduced using the reported test case:
#include <sigc++/sigc++.h>
#if __cplusplus >= 201100L || defined (__GXX_EXPERIMENTAL_CXX0X__)
#include <type_traits>
namespace sigc
{
template <typename Functor>
struct functor_trait<Functor, false>
{
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
}
#endif
int main()
{
sigc::slot <bool> slot3 = [] () -> bool { return true; };
sigc::slot <bool, int> slot4 = [] (int) -> bool { return true; };
while (1);
}
and building it on Fedora 16 with
g++ -std=c++0x -g -o pr pr.cc $(pkg-config --cflags sigc++-2.0) $(pkg-config
--libs sigc++-2.0)
Simplest way to see it is "gdb -readnow pr"
--
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 c++/14365] gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
` (3 preceding siblings ...)
2012-08-01 18:58 ` tromey at redhat dot com
@ 2012-08-03 17:22 ` keiths at redhat dot com
2012-08-19 19:38 ` cvs-commit at gcc dot gnu.org
2012-08-19 19:40 ` keiths at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: keiths at redhat dot com @ 2012-08-03 17:22 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
Keith Seitz <keiths at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |keiths at redhat dot com
--- Comment #4 from Keith Seitz <keiths at redhat dot com> 2012-08-03 17:22:08 UTC ---
I think Tom is correct. IMO the questionable thing done here is asking
c_type_print_base to print details of the type when we have a pointer
member/method whose containing class/struct is anonymous (TYPE_NAME (type) ==
NULL). That just doesn't seem right.
I believe the proper fix is simply for c_type_print_varspec_prefix to honor the
SHOW parameter when it is calling other c_type_print_* functions.
In this function, the only cases which do not pass SHOW to the other type
printing functions are MEMBERPTR and METHODPTR, exactly where we are seeing
problems.
I'm working on a test case for this now, and will submit a patch when it is
finished. [It requires hand-written DWARF.]
--
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 c++/14365] gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
` (4 preceding siblings ...)
2012-08-03 17:22 ` keiths at redhat dot com
@ 2012-08-19 19:38 ` cvs-commit at gcc dot gnu.org
2012-08-19 19:40 ` keiths at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-08-19 19:38 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-08-19 19:37:57 UTC ---
CVSROOT: /cvs/src
Module name: src
Changes by: kseitz@sourceware.org 2012-08-19 19:37:51
Modified files:
gdb : ChangeLog c-typeprint.c
gdb/testsuite : ChangeLog
Added files:
gdb/testsuite/gdb.dwarf2: dw2-anon-mptr.exp dw2-anon-mptr.S
Log message:
PR c++/14365
* c-typeprint.c (c_type_print_varspec_prefix): Pass
-1 for SHOW to c_type_print_base for METHODPTR and MEMBERPTR.
* gdb.dwarf2/dw2-anon-mptr.exp: New file.
* gdb.dwarf2/dw2-anon-mptr.S: New file.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14602&r2=1.14603
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/c-typeprint.c.diff?cvsroot=src&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3343&r2=1.3344
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S.diff?cvsroot=src&r1=NONE&r2=1.1
--
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 c++/14365] gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor)
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
` (5 preceding siblings ...)
2012-08-19 19:38 ` cvs-commit at gcc dot gnu.org
@ 2012-08-19 19:40 ` keiths at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: keiths at redhat dot com @ 2012-08-19 19:40 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=14365
Keith Seitz <keiths at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
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-19 19:40:00 UTC ---
I have committed a patch to fix this. If there are any further problems, please
let me know.
--
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:[~2012-08-19 19:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-14 13:30 [Bug c++/14365] New: gdb crashes when checking ctor of lambdas (in is_ctor_or_dtor) marco.trevisan at canonical dot com
2012-07-14 13:35 ` [Bug c++/14365] " marco.trevisan at canonical dot com
2012-07-15 12:55 ` jan.kratochvil at redhat dot com
2012-08-01 18:55 ` tromey at redhat dot com
2012-08-01 18:58 ` tromey at redhat dot com
2012-08-03 17:22 ` keiths at redhat dot com
2012-08-19 19:38 ` cvs-commit at gcc dot gnu.org
2012-08-19 19:40 ` 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).