public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26851] New: Make next not skip over GOMP_parallel
@ 2020-11-08 15:04 vries at gcc dot gnu.org
2020-11-08 15:12 ` [Bug gdb/26851] " vries at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-08 15:04 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26851
Bug ID: 26851
Summary: Make next not skip over GOMP_parallel
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Consider test-case gdb/testsuite/gdb.fortran/omp-step.f90 as found in fedora
patch gdb-bz533176-fortran-omp-step.patch (
https://src.fedoraproject.org/rpms/gdb/blob/HEAD/f/gdb-bz533176-fortran-omp-step.patch
) :
...
16 use omp_lib
17 integer nthreads, i, a(1000)
18 nthreads = omp_get_num_threads()
19 if (nthreads .gt. 1000) call abort
20
21 do i = 1, nthreads
22 a(i) = 0
23 end do
24 print *, "start-here"
25 !$omp parallel
26 a(omp_get_thread_num() + 1) = 1
27 !$omp end parallel
28 do i = 1, nthreads
29 if (a(i) .ne. 1) call abort
30 end do
31 print *, "success"
32 end
...
Ideally, a next at line 25 would get us to line 26, the parallel body.
However, that's not the case, we end up at line 28, after the parallel body:
...
$ gdb -q outputs/gdb.fortran/omp-step/omp-step
Reading symbols from omp-step...
(gdb) b 24
Breakpoint 1 at 0x400910: file omp-step.f90, line 24.
(gdb) r
Starting program: omp-step
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1, MAIN__ ()
at omp-step.f90:24
24 print *, "start-here"
(gdb) n
start-here
25 !$omp parallel
(gdb) n
[New Thread 0x7ffff684a700 (LWP 3404)]
[New Thread 0x7ffff6049700 (LWP 3405)]
[New Thread 0x7ffff5848700 (LWP 3406)]
28 do i = 1, nthreads
(gdb)
...
The fedora patch contains code to fix this, but it doesn't seem to work.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/26851] Make next not skip over GOMP_parallel
2020-11-08 15:04 [Bug gdb/26851] New: Make next not skip over GOMP_parallel vries at gcc dot gnu.org
@ 2020-11-08 15:12 ` vries at gcc dot gnu.org
2020-11-08 15:13 ` vries at gcc dot gnu.org
2020-11-09 11:06 ` vries at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-08 15:12 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26851
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |keiths at redhat dot com,
| |kevinb at sourceware dot org,
| |palves at sourceware dot org
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
This works for me, but has hardcoded x86_64 abi knowledge (reading first arg to
GOMP_parallel from rdi reg at index 5):
...
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 4c2e1f56d2..782c6726c4 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6788,6 +6788,22 @@ process_event_stop_test (struct execution_control_state
*ecs)
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
{
+ const char *gomp_parallel = "GOMP_parallel";
+ bool gomp_parallel_p
+ = (ecs->stop_func_name != NULL
+ && strncmp (ecs->stop_func_name, gomp_parallel,
+ strlen (gomp_parallel)) == 0);
+ if (gomp_parallel_p)
+ {
+ struct regcache *regcache
+ = get_thread_regcache (ecs->event_thread);
+ ULONGEST val;
+ regcache_cooked_read_unsigned (regcache, 5, &val);
+
+ ecs->stop_func_start = val;
+ goto step_into;
+ }
+
/* We're doing a "next".
Normal (forward) execution: set a breakpoint at the
@@ -6846,6 +6862,7 @@ process_event_stop_test (struct execution_control_state
*ecs)
return;
}
+ step_into:
/* If we have line number information for the function we are
thinking of stepping into and the function isn't on the skip
list, step into it.
...
And with this patch, the test-case from the fedora patch does:
...
25 !$omp parallel^M
(gdb) PASS: gdb.fortran/omp-step.exp: step closer
next^M
[New Thread 0x7ffff684a700 (LWP 2877)]^M
[New Thread 0x7ffff6049700 (LWP 2878)]^M
[New Thread 0x7ffff5848700 (LWP 2879)]^M
MAIN__._omp_fn.0 () at omp-step.f90:26^M
26 a(omp_get_thread_num() + 1) = 1^M
(gdb) PASS: gdb.fortran/omp-step.exp: step into omp
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/26851] Make next not skip over GOMP_parallel
2020-11-08 15:04 [Bug gdb/26851] New: Make next not skip over GOMP_parallel vries at gcc dot gnu.org
2020-11-08 15:12 ` [Bug gdb/26851] " vries at gcc dot gnu.org
@ 2020-11-08 15:13 ` vries at gcc dot gnu.org
2020-11-09 11:06 ` vries at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-08 15:13 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26851
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
See also https://bugzilla.redhat.com/show_bug.cgi?id=533176
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/26851] Make next not skip over GOMP_parallel
2020-11-08 15:04 [Bug gdb/26851] New: Make next not skip over GOMP_parallel vries at gcc dot gnu.org
2020-11-08 15:12 ` [Bug gdb/26851] " vries at gcc dot gnu.org
2020-11-08 15:13 ` vries at gcc dot gnu.org
@ 2020-11-09 11:06 ` vries at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-09 11:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26851
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> This works for me, but has hardcoded x86_64 abi knowledge (reading first arg
> to GOMP_parallel from rdi reg at index 5):
Alternatively, we can use libgomp debuginfo to get the arg.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-09 11:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-08 15:04 [Bug gdb/26851] New: Make next not skip over GOMP_parallel vries at gcc dot gnu.org
2020-11-08 15:12 ` [Bug gdb/26851] " vries at gcc dot gnu.org
2020-11-08 15:13 ` vries at gcc dot gnu.org
2020-11-09 11:06 ` vries at gcc dot gnu.org
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).