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