FAQ:How do I use gdb with nuwa?

From Daya Bay
Jump to navigation Jump to search
Offline Documentation: [Offline Category] [FAQ] [Howto] [Reference] [Manual]


Offline Documentation
This article is part
of the Offline Documentation
Other pages...

Offline Category
FAQ
How Tos
Reference
Manual
Getting Started
Software Installation

See also...

General Help on this Wiki


Running nuwa.py under GDB

There are several ways to use gdb to debug problems with the NuWa software. They all boil down to running nuwa.py under GDB

Here, it is assumed the problematic job is simply:

nuwa.py -n 10 input.root

Start the job with GDB on the shell command line

If you know the job is going to crash, this is the easiest way to re-run it under gdb. You tell gdb the command line with "--args" flag. And, because it needs the full path to both the python executable and the nuwa.py script you can use your shell to expand them:

shell> gdb --args $(which python) $(which nuwa.py) -n 10 input.root

Attach to an already running job

This is useful if the job is already running and you want to connect gdb to it. This will be useful to debug infinite loops.

Start the job and record the process ID:

shell> nuwa.py -n 10 input.root > log 2>&1 &
[1] <PID>

Or, if you don't have the PID, get it:

shell> ps auxww|grep nuwa.py
(check PID)

Now connect to the PID:

shell> gdb $(which python) <PID>

Related links and info

Offline Software Documentation: [Offline Categories] [FAQ] [Offline Faq Category]