GNU UPC

... Unified Parallel C

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

GDB UPC Sample Sessions - Single Unix Process

E-mail Print PDF
Article Index
GDB UPC Sample Sessions
Multiple Unix Processes
Single Unix Process
Multiple Posix Threads
Single Thread Debugging
All Pages

Debugging of only one UPC thread as a Unix process is similar to debugging multiple of them. The only difference is in the start-up code where thread start synchronization gate is not used at all. In this case the user can simple insert the breakpoint in the main UPC function and start running the application. One the break point is reached, upc-sync command can be used to switch GDB UPC into the UPC mode.

Single Unix Process

Compile Options
-g -O0
-dwarf-2-upc
Debugging Options
  set pagination off
set target-async on

set detach-on-fork off

set non-stop on

set upcstartgate on
Sample Debugging Session
Compile example code (static or dynamic thread allocation can be used):
$ upc -fupc-threads-1 -g -O0 -dwarf-2-upc \
-o upc-example upc-example.upc
Create GDB's startup file .gdbinitin the current directory with the following content:
set pagination off
set target-async on
set detach-on-fork off
set non-stop on
set upcstartgate on

Note: You may chose to create some other file instead of .gdbinit.In this case you will need to run GDB UPC with "-x your-startup-file" option.
Note: upcstartgate option is not necessary as one thread GCC UPC run-time does not uses thread synchronization mechanism.

Specify UPC Debugging Assistant shared library for GCC UPC compiler:

csh shell:
$ setenv UDA_GUPC_PLUGIN_LIBRARY [...]/plugin/uda-plugin.so

bash shell:
$ UDA_GUPC_PLUGIN_LIBRARY=[...]/plugin/uda-plugin.so
$ export UDA_GUPC_PLUGIN_LIBRAR

Make sure that GDB on your path is indeed GDB UPC. For example:

$ gdb -v
GNU gdb (GDB) 7.1.50.2 20100918 (GDB UPC/dev)
Copyright (C) 2010 Free Software Foundation, Inc.
[...]
For bug reporting instructions, please see:
[...]

At this point you can start your debugging session.

$ gdb upc_example
[...]
(gdb) b upc_main
Breakpoint 1 at 0x4016cd: file upc-example.upc, line 23.
(gdb) r
Starting program: /eng/upc/dev/nenad/GDB UPC-dev/examples/upc-example
Breakpoint 1, main () at upc-example.upc:23
23······· if (!MYTHREAD)
Current language:· auto
The current source language is "auto; currently upc".
(gdb)

At this point the only UPC thread is running, however GDB UPC is still in the GDB mode. Execute upc-init command to enable the UPC mode and initalize UDA plugin.

(gdb) upc-init
UPC Mode activated.
upc_lang: using GUPC plugin.
(gdb-upc) info threads
* 1 UPC Thread 0· main () at upc-example.upc:23
(gdb-upc)
As you are working with only one thread collective features of GDB UPC (breakpoint, stepping) don't have any effect on debugging.

 



You are here: