Debugging
For debugging purposes NEC provides a number of helpful tools.
Libomptarget
If the debug-version of libomptarget was build, LIBOMPTARGET_DEBUG=1
can be used to show additional debugging information at runtime.
Tip
Use LIBOMPTARGET_DEBUG=4
to dump host-target pointer mappings.
log4crc
See Debugging with log4crc by Erich Focht
NEC Parallel Debugger
The NEC parallel debugger can be invoked from within the eclipse IDE. For detailed instructions see the users guide.
GDB
NEC provides a ported version of gdb
for VE with specific commands and abilities for them.
There are the following difference points between the ported version of GDB for VE and GDB for Linux:
-
GDB internally executes
ve_exec
command with--traceme
option in order to execute VE program. -
VE_NODE_NUMBER
environment variable can be used to specify VE node to execute VE program. If the environment variable is not set, VE program is executed on VE node 0. -
Only local debugging is supported. Remote debugging using GDB server or GDB stub is not supported.
-
The directory where separate debug symbols are searched for is
/opt/nec/ve/lib/debug
. -
GDB can not deal with thread-local variables correctly, because DWARF information about them is invalid.
-
The following commands don't show information for VE side but show for VH side using procfs of it.
info proc info proc all info proc cmdline info proc cwd info proc exe info proc mappings info proc stat info proc status
-
info auxv
command is available only in debugging with core file. -
GDB and VEOS does not handle invocation of
execve()
system call from a VE program properly. When a VE program invokesexecve()
system call, GDB detectsSIGTRAP
, or can not find the process or the thread, and then it does not reload a new program. In this case,quit
command need to be executed to terminate GDB. The debugged process will be killed when GDB terminates, if it has been executed from GDB. -
call
command can be used to invoke a function of a VE program. But, if stack area beyond page boundary is required,call
command fails due to access error. -
IC will be far from the address which causes a HW exception when the program is stopped by the HW exception.
advance off
mode can be set in order to check the precise state when HW exception occurs. In this mode, instruction execution is held until the preceding instructions have completed. As the result, GDB shows the precise state when HW exception occurs.
A full list of differences can be found here.
Helpers
Delay Target Code Execution
To be able to attach a debugger to the target code more easily the NEC_TARGET_DELAY
environment variable is provided.
When compiling an application with NEC_TARGET_DELAY
, code is injected into the target executable,
which, at runtime, applies the value of this variable to the C sleep function,
as to delay the start of execution by that number of seconds.
Note
If NEC_TARGET_DELAY
is not set at runtime, then its value will default to zero.