This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix debuginfo in -fopenmp code (PR debug/87039)
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, Jason Merrill <jason at redhat dot com>, Martin Jambor <mjambor at suse dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 9 Dec 2018 21:37:58 -0700
- Subject: Re: [PATCH] Fix debuginfo in -fopenmp code (PR debug/87039)
- References: <20181116211000.GL11625@tucnak>
On Fri, 16 Nov 2018 22:10:00 +0100
Jakub Jelinek <firstname.lastname@example.org> wrote:
> Kevin, did you have some gdb testcases you were trying for the r253335
> change? Can you try those with added another e.g. parallel around it (say
> #pragma omp parallel if (0) or num_threads (1), so that it doesn't spawn too
> many children and see if you can check variables not mentioned in the inner
> parallel inside of the outer parallel, or even outside of the outer
Sorry for the delayed response - I had some issues on the GDB side of
things that needed to be addressed before I could properly test your
In the GDB test that I've written, I test four scenarios:
1) Simple parallel region with no additional lexical scopes.
2) Like the above, but with additional lexical scopes.
3) Parallel region within nested function.
4) Nested parallel regions.
With your patch in place, I see correct results for scenarios 1, 2,
and 3. Scenario 4 works better than it ever did in the past, though
there are still some problems. Here is that test case - just
static int file_scope_var = 9876;
int i = 1, j = 2;
int l = -1;
#pragma omp parallel num_threads (2) private (l)
int num = omp_get_thread_num ();
int nthr = omp_get_num_threads ();
int off = num * nthr;
int k = off + 101;
l = off + 102;
#pragma omp parallel num_threads (2) shared (num)
#pragma omp critical
printf ("nested_parallel (inner threads): outer thread num = %d, thread num = %d\n", num, omp_get_thread_num ());
#pragma omp critical
printf ("nested_parallel (outer threads) %d: k = %d, l = %d\n", num, k, l);
Breakpoints are placed on both of the printfs and attempts are made to
print some of the variables that should be in scope at each stop. For
the "inner threads" printf, there are four stops altogether.
At each stop for those inner threads, GDB is able to successfully print
file_scope_var, num, i, and j.
For all but one of the stops, GDB is able to print the values for l and k.
Here is the log output for the fourth stop in which GDB cannot print out
either l or k:
No frame is currently executing in block nested_parallel._omp_fn.3.
(gdb) XFAIL: gdb.threads/omp-par-scope.exp: nested_parallel: inner_threads: 4th stop: print l
No frame is currently executing in specified block
(gdb) XFAIL: gdb.threads/omp-par-scope.exp: nested_parallel: inner_threads: 4th stop: print k
These failures are not entirely unexpected due to the fact that GDB is
not always able to correctly determine the thread parent for the nested
parallel case. (Additional support will be required from libgomp.)
I still need to do some investigation to find out whether the messages
being printed make sense.
Anyway... I'm all in favor of your patch. It fixes a bunch of failures
that I had been seeing for quite a while.