[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] FW: Eclipse CDT : debugging with OpenMP and switching between threads

What do you mean "you can't switch between threads"?
If you don't see the code, it does not mean you are looking at the right thread.
 
Try setting a breakpoint in the thread code, and let the program run to it.
It should interrupt in visible code.
 
Marc


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Franck Houssen
Sent: Wednesday, January 18, 2012 7:32 AM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] FW: Eclipse CDT : debugging with OpenMP and switching between threads

Just adding a few updates :
  1. In the debugger tab of my local application configuration, I tried to use "automatic debug forked process" setting
  2. I tried to create a .gdbinit file (in the project work directory) containing the line : set follow-fork-mode child


I still can NOT switch between threads when debugging.



Thanks if you can help !...


FH



From: fh_p@xxxxxxxxxxx
To: cdt-dev@xxxxxxxxxxx
Date: Wed, 18 Jan 2012 12:00:07 +0100
Subject: [cdt-dev] Eclipse CDT : debugging with OpenMP and switching between threads

Hello,

With a CDT C/C++ local application configuration I try to debug an OpenMP program : switching between threads is impossible.

I use Ubuntu 11.10 with gdb 7.3, my version of Eclipse is : Eclipse IDE for Parallel Application Developers, Version: Indigo Service Release 1, Build id: 20110916-0149.
My eclipse installation uses :  org.eclipse.cdt_8.0.0.201109151620.jar

OpenMP program is compiled using makefile project (with debug flag : g++ -g -openmp) :
  1. Run is OK both in Eclipse and outside of Eclipse (xterm)
  2. Debugging only the main thread is possible in Eclipse
  3. Switching between threads is impossible both in Eclipse and outside of Eclipse (xterm)

I would like to be able to switch between threads when debugging : I can't. Could you tell me if this problem may be fixed by turning on / off a setting in Eclipse ? By modifying compilation options in the Makefile ? By modifying / upgrading the Eclipse installation (and, in this case, how to do it) ? Or, could you tell me if this problem is only related to gdb : in this case, do you know which version of gdb enables to switch between threads when debugging ? Am I supposed to use another debugger than gdb : if yes, which one ?

Regards,

FH


From: fh_p@xxxxxxxxxxx
To: ptp-user@xxxxxxxxxxx
Date: Wed, 18 Jan 2012 11:16:35 +0100
Subject: Re: [ptp-user] Eclipse PTP : debugging with OpenMP and switching between threads

Greg, Beth, thanks for your answers that helped me to clarify some Eclipse behaviors : it seems this problem is actually related to gdb but not to Eclipse.

My version of gdb is the following :
~ > gdb --version
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08

It seems this version of gdb does not enable to debug thread as I get same kind of problems in an xterm (outside of Eclipse) :
(gdb) info threads
  Id   Target Id         Frame
  4    Thread 0x7ffff5c66700 (LWP 4695) "OpenMPCpp.exe" 0x00007ffff78d039e in ?? () from /usr/lib/x86_64-linux-gnu/libgomp.so.1
  3    Thread 0x7ffff6467700 (LWP 4694) "OpenMPCpp.exe" 0x00007ffff78d039c in ?? () from /usr/lib/x86_64-linux-gnu/libgomp.so.1
  2    Thread 0x7ffff6c68700 (LWP 4693) "OpenMPCpp.exe" 0x00007ffff78d039c in ?? () from /usr/lib/x86_64-linux-gnu/libgomp.so.1
* 1    Thread 0x7ffff7fe17a0 (LWP 4690) "OpenMPCpp.exe" main () at OpenMPCpp.cpp:10

Accessing the stack of thread 2 seems to be impossible :
(gdb) thread 2
[Switching to thread 2 (Thread 0x7ffff6c68700 (LWP 4693))]
#0  0x00007ffff78d039c in ?? () from /usr/lib/x86_64-linux-gnu/libgomp.so.1
(gdb) n
Cannot find bounds of current function

But, accessing the stack of thread 1 is possible :
(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff7fe17a0 (LWP 4690))]
#0  main () at OpenMPCpp.cpp:10
10        cout << "Good night   from thread " << omp_get_thread_num() << " / " << omp_get_num_threads() << endl;
(gdb) n
Good night   from thread 0 / 1
11        return 0;

I guess I will have to ask for advice to the CDT mailing list/forum... Unless somebody can tell me what I missed.

Regards,

FH


From: g.watson@xxxxxxxxxxxx
Date: Mon, 16 Jan 2012 10:04:01 -0500
To: ptp-user@xxxxxxxxxxx
Subject: Re: [ptp-user] Eclipse PTP : debugging with OpenMP and switching between threads

Hi,

For running/debugging an OpenMP program on your local machine (the one running Eclipse), using the C/C+ Application launch configuration (which is provided by the CDT project) like you are doing is probably the best way. Note that when you set a breakpoint using the CDT debugger, make sure you use a C/C++ Breakpoint, not a Parallel Breakpoint (which have different icons). You can change this by right clicking on the left-hand marker bar in the editor (the one where breakpoints are shown) and selecting Breakpoint Type>C/C++ Breakpoint.

I believe you should be able to see the thread stack and control a thread like a process. However, thread support is entirely dependent on the version of gdb you have installed. Later versions of gdb provide better thread support than earlier versions. If you have questions about debugging using the CDT debugger, you should direct these to the CDT mailing list/forum.

For running/debugging a mixed MPI + OpenMP application, you should use one of the PTP resource managers that matches your system configuration. Your debugging capability will vary depending on the type of runtime system and resource manager you have on the machine. 

Regards,
Greg

On Jan 16, 2012, at 7:00 AM, Franck Houssen wrote:

Hello,

I use Ubuntu 11.10 and my version of Eclipse is : Eclipse IDE for Parallel Application Developers, Version: Indigo Service Release 1, Build id: 20110916-0149.

I am new to Eclipse. I created a makefile project (with debug flag : g++ -g -openmp) to compile an OpenMP program : compiling is OK (and run outside eclipse in an xterm is OK).
I have 2 questions about running / debugging OpenMP in Eclipse :
  1. To run a simple OpenMP project, am I supposed to create a "local" or a "parallel" application configuration ? My understanding is that when using only OpenMP (as I do here) local configuration are the one to use, but, when using both OpenMPI + OpenMP parallel configuration are the one to use (because of MPI). Am I right ? If not, which kind of resource manager should be created to handle OpenMP (I have no OpenMP resource manager available) ?
  2. When debugging a simple OpenMP project, is possible to switch between threads (at the same time, current line code may not be the same for each thread) ? I believed it could be possible to follow OpenMP threads in the same way that it is possible to follow OpenMPI processus : is this possible ? As point 1 mentions it, I use a local configuration and -g when compiling to enable accessing thread stack : when debugging I see the 4 threads of my PC but I can only access the main thread (see attached pictures - threads 2 and 3 behave like thread 4 : impossible to access any level of the thread stack)


Regards,


FH

<DebugThread1.png><DebugThread4.png>_______________________________________________
ptp-user mailing list
ptp-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-user


_______________________________________________ ptp-user mailing list ptp-user@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/ptp-user

_______________________________________________ ptp-user mailing list ptp-user@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/ptp-user

_______________________________________________ cdt-dev mailing list cdt-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/cdt-dev