From: Dodji Seketeli Date: Mon, 2 Jan 2012 17:08:48 +0000 (+0000) Subject: PR debug/49951 - jumpy stepping at end of scope in C++ X-Git-Tag: releases/gcc-4.5.4~296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b0dd5d1e12847825f18d2a3a2374bb4967cf971;p=thirdparty%2Fgcc.git PR debug/49951 - jumpy stepping at end of scope in C++ gcc/cp/ PR debug/49951 * decl.c (cxx_maybe_build_cleanup): Don't set location of the call to the destructor. gcc/testsuite/ PR debug/49951 * g++.dg/gcov/gcov-2.C: Adjust. From-SVN: r182808 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2f94d210c6da..7cdca29fd2c0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-12-20 Dodji Seketeli + + PR debug/49951 + * decl.c (cxx_maybe_build_cleanup): Don't set location of the call + to the destructor. + 2011-12-13 Jason Merrill PR c++/51406 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d2e3d29615f1..c62a1ad2d24d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12877,8 +12877,17 @@ cxx_maybe_build_cleanup (tree decl) cleanup = call; } + /* build_delete sets the location of the destructor call to the + current location, even though the destructor is going to be + called later, at the end of the current scope. This can lead to + a "jumpy" behaviour for users of debuggers when they step around + the end of the block. So let's unset the location of the + destructor call instead. */ + if (cleanup != NULL && EXPR_P (cleanup)) + SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION); return cleanup; } + /* When a stmt has been parsed, this function is called. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8319732b01ee..5ed1ab281c99 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-20 Dodji Seketeli + + PR debug/49951 + * g++.dg/gcov/gcov-2.C: Adjust. + 2011-12-13 Jason Merrill PR c++/51406 diff --git a/gcc/testsuite/g++.dg/gcov/gcov-2.C b/gcc/testsuite/g++.dg/gcov/gcov-2.C index 6d002f5d2cd0..66d8af39bce4 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-2.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-2.C @@ -20,7 +20,7 @@ private: void foo() { - C c; /* count(2) */ + C c; /* count(1) */ c.seti (1); /* count(1) */ }