|
|
01917d |
https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
|
|
|
01917d |
|
|
|
01917d |
I find it a bug in DWARF and gdb behaves correctly according to it. From the
|
|
|
01917d |
current DWARF's point of view the is a function call which you skip by "next".
|
|
|
01917d |
|
|
|
01917d |
If you hide any /usr/lib/debug such as using:
|
|
|
01917d |
gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
|
|
|
01917d |
and use "step" command instead of "next" there it will work.
|
|
|
01917d |
(You need to hide debuginfo from libgomp as you would step into libgomp sources
|
|
|
01917d |
to maintain the threads for execution.)
|
|
|
01917d |
|
|
|
01917d |
There should be some DWARF extension for it, currently tried to detect
|
|
|
01917d |
substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
|
|
|
01917d |
consider such sub-function as a skippable by "next".
|
|
|
01917d |
|
|
|
01917d |
Another problem is that with "set scheduler-locking" being "off" (default
|
|
|
01917d |
upstream) or "step" (default in F/RHEL) the simultaneous execution of the
|
|
|
01917d |
threads is inconvenient. Setting it to "on" will lockup the debugging as the
|
|
|
01917d |
threads need to get synchronized at some point. This is a more general
|
|
|
01917d |
debugging problem of GOMP outside of the scope of this Bug.
|
|
|
01917d |
|
|
|
01917d |
|
|
|
01917d |
|
|
|
01917d |
Index: gdb-7.5.50.20130118/gdb/infrun.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.5.50.20130118.orig/gdb/infrun.c 2013-01-19 23:38:22.329371410 +0100
|
|
|
01917d |
+++ gdb-7.5.50.20130118/gdb/infrun.c 2013-01-19 23:39:03.322429041 +0100
|
|
|
01917d |
@@ -4918,6 +4918,16 @@ process_event_stop_test:
|
|
|
01917d |
|
|
|
01917d |
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
|
|
|
01917d |
{
|
|
|
01917d |
+ struct symbol *stop_fn = find_pc_function (stop_pc);
|
|
|
01917d |
+ struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc);
|
|
|
01917d |
+
|
|
|
01917d |
+ if ((stop_fn == NULL
|
|
|
01917d |
+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
|
|
|
01917d |
+ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */
|
|
|
01917d |
+ && (stopf == NULL
|
|
|
01917d |
+ || strstr (SYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
|
|
|
01917d |
+{ /* ".omp_fn." */
|
|
|
01917d |
+
|
|
|
01917d |
/* We're doing a "next".
|
|
|
01917d |
|
|
|
01917d |
Normal (forward) execution: set a breakpoint at the
|
|
|
01917d |
@@ -4953,6 +4963,7 @@ process_event_stop_test:
|
|
|
01917d |
|
|
|
01917d |
keep_going (ecs);
|
|
|
01917d |
return;
|
|
|
01917d |
+} /* ".omp_fn." */
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
/* If we are in a function call trampoline (a stub between the
|
|
|
01917d |
Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.exp
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
01917d |
+++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.exp 2013-01-19 23:38:23.213372622 +0100
|
|
|
01917d |
@@ -0,0 +1,31 @@
|
|
|
01917d |
+# Copyright 2009 Free Software Foundation, Inc.
|
|
|
01917d |
+
|
|
|
01917d |
+# This program is free software; you can redistribute it and/or modify
|
|
|
01917d |
+# it under the terms of the GNU General Public License as published by
|
|
|
01917d |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
01917d |
+# (at your option) any later version.
|
|
|
01917d |
+#
|
|
|
01917d |
+# This program is distributed in the hope that it will be useful,
|
|
|
01917d |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
01917d |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
01917d |
+# GNU General Public License for more details.
|
|
|
01917d |
+#
|
|
|
01917d |
+# You should have received a copy of the GNU General Public License
|
|
|
01917d |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
01917d |
+
|
|
|
01917d |
+set testfile "omp-step"
|
|
|
01917d |
+set srcfile ${testfile}.f90
|
|
|
01917d |
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90 additional_flags=-fopenmp}] } {
|
|
|
01917d |
+ return -1
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+if ![runto [gdb_get_line_number "start-here"]] {
|
|
|
01917d |
+ perror "Couldn't run to start-here"
|
|
|
01917d |
+ return 0
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+gdb_test "next" {!\$omp parallel} "step closer"
|
|
|
01917d |
+gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
|
|
|
01917d |
+
|
|
|
01917d |
+gdb_breakpoint [gdb_get_line_number "success"]
|
|
|
01917d |
+gdb_continue_to_breakpoint "success" ".*success.*"
|
|
|
01917d |
Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.f90
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
01917d |
+++ gdb-7.5.50.20130118/gdb/testsuite/gdb.fortran/omp-step.f90 2013-01-19 23:38:23.213372622 +0100
|
|
|
01917d |
@@ -0,0 +1,32 @@
|
|
|
01917d |
+! Copyright 2009 Free Software Foundation, Inc.
|
|
|
01917d |
+
|
|
|
01917d |
+! This program is free software; you can redistribute it and/or modify
|
|
|
01917d |
+! it under the terms of the GNU General Public License as published by
|
|
|
01917d |
+! the Free Software Foundation; either version 3 of the License, or
|
|
|
01917d |
+! (at your option) any later version.
|
|
|
01917d |
+!
|
|
|
01917d |
+! This program is distributed in the hope that it will be useful,
|
|
|
01917d |
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
01917d |
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
01917d |
+! GNU General Public License for more details.
|
|
|
01917d |
+!
|
|
|
01917d |
+! You should have received a copy of the GNU General Public License
|
|
|
01917d |
+! along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
01917d |
+
|
|
|
01917d |
+ use omp_lib
|
|
|
01917d |
+ integer nthreads, i, a(1000)
|
|
|
01917d |
+ nthreads = omp_get_num_threads()
|
|
|
01917d |
+ if (nthreads .gt. 1000) call abort
|
|
|
01917d |
+
|
|
|
01917d |
+ do i = 1, nthreads
|
|
|
01917d |
+ a(i) = 0
|
|
|
01917d |
+ end do
|
|
|
01917d |
+ print *, "start-here"
|
|
|
01917d |
+!$omp parallel
|
|
|
01917d |
+ a(omp_get_thread_num() + 1) = 1
|
|
|
01917d |
+!$omp end parallel
|
|
|
01917d |
+ do i = 1, nthreads
|
|
|
01917d |
+ if (a(i) .ne. 1) call abort
|
|
|
01917d |
+ end do
|
|
|
01917d |
+ print *, "success"
|
|
|
01917d |
+ end
|