Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.590 diff -u -p -r1.590 infrun.c --- infrun.c 3 Sep 2013 17:22:45 -0000 1.590 +++ infrun.c 17 Sep 2013 07:51:11 -0000 @@ -3038,7 +3038,8 @@ adjust_pc_after_break (struct execution_ if (singlestep_breakpoints_inserted_p || !ptid_equal (ecs->ptid, inferior_ptid) || !currently_stepping (ecs->event_thread) - || ecs->event_thread->prev_pc == breakpoint_pc) + || (ecs->event_thread->prev_pc == breakpoint_pc + && software_breakpoint_inserted_here_p (aspace, breakpoint_pc))) regcache_write_pc (regcache, breakpoint_pc); do_cleanups (old_cleanups); Index: testsuite/gdb.base/pr15520.cc =================================================================== RCS file: testsuite/gdb.base/pr15520.cc diff -N testsuite/gdb.base/pr15520.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.base/pr15520.cc 17 Sep 2013 07:51:12 -0000 @@ -0,0 +1,34 @@ +/* This testcase is part of GDB, the GNU debugger. + Copyright 2012-2013 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 . */ + +#include +using namespace std; + +void +fun (string &str1, string &str2) +{ + str1 += str2; +} + +int +main (void) +{ + string str1 = "abc"; + string str2 = "def"; + fun(str1,str2); + + return 0; +} Index: testsuite/gdb.base/pr15520.exp =================================================================== RCS file: testsuite/gdb.base/pr15520.exp diff -N testsuite/gdb.base/pr15520.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.base/pr15520.exp 17 Sep 2013 07:51:12 -0000 @@ -0,0 +1,36 @@ +# Copyright 2013 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 . + +# +# test running programs +# +standard_testfile .cc + +if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { + return -1 +} + +gdb_test_no_output "set target-async on" "set async mode" +gdb_test_no_output "set non-stop on" "set non-stop mode" + +if ![runto_main] { + untested non-stop-step + return -1 +} + +gdb_breakpoint "fun" +gdb_continue_to_breakpoint "fun" +gdb_test "step" ".*}.*" "step 1" +gdb_test "step" ".*main .*$srcfile.*\[\n\r\].*return 0;.*" "step 2"