Spin (local AE)
Spin (Local AE)
Use spin in local AE mode. To do so, register the name of a file with the environment variable NZAE_SPIN_FILE_NAME.
If the file exists, the AE waits until one of the following conditions is met:
- You delete the file.
- You attach the file to the AE process by using GDB; then you set the stopLoopFlag variable to 1.
To register the file name, do the following steps:
- Register the file name as follows (using the applyopcpp
case):
--environment "'NZAE_SPIN_FILE_NAME'='/tmp/spin_ae'"The complete command looks like:
$NZ_EXPORT_DIR/ae/utilities/bin/register_ae --language cpp --version 3 \ --db dev --template udf --sig "apply(varargs)" --return "double" \ --exe testapply --environment "'NZAE_TERMINAL'='/dev/pts/4'" \ --environment "'NZAE_SPIN_FILE_NAME'='/tmp/spin_ae'" - Create the spin file:
touch /tmp/spin_ae - When you run the query, you need to find the process to attach to. Because you specified
NZAE_TERMINAL when you registered, you see the following in the terminal window:
spinning in process id=28618, thread id=28618 on file /tmp/spin_ae - You can then attach it through
GDB:
gdb /nz/export/ae/applications/dev/admin/host/testapply 28618 GNU gdb Fedora (6.8-27.el5) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu"... Attaching to program: /nz/export/ae/applications/dev/admin/host/testapply, process 28618 Reading symbols from /nz/data/base/200103/library/209623/host/libnzaecpp3.so...done. Loaded symbols for /nz/data/base/200103/library/209623/host/libnzaecpp3.so Reading symbols from /nz/data/base/200103/library/200652/host/libnzaechild.so...done. Loaded symbols for /nz/data/base/200103/library/200652/host/libnzaechild.so Reading symbols from /lib/libpthread.so.0...done. [Thread debugging using libthread_db enabled] [New Thread 0xf7e3bad0 (LWP 28618)] Loaded symbols for /lib/libpthread.so.0 Reading symbols from /usr/lib/libstdc++.so.6...done. Loaded symbols for /usr/lib/libstdc++.so.6 Reading symbols from /lib/libm.so.6...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/libgcc_s.so.1...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /lib/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 0xffffe410 in __kernel_vsyscall () (gdb) bt #0 0xffffe410 in __kernel_vsyscall () #1 0x0088b290 in __nanosleep_nocancel () from /lib/libc.so.6 #2 0x0088b0df in sleep () from /lib/libc.so.6 #3 0xf7e7d1ca in _nzaeCheckForSpinFile (spinFileName=0xffd0a7ff \ "/tmp/spin_ae") at nzaediagnostics.c:43 #4 0xf7e75e16 in _nzaeInitializeInternal (arg=0xffd081d0, internalUse=false) \ at nzae.c:31 #5 0xf7e75da1 in nzaeInitialize (arg=0xffd081d0) at nzae.c:19 #6 0xf7e80c97 in nzaeLocprotGetApi (result=0xffd08a44, ldkVersion=2, \ errorMessage=0xffd08627 "", errorMessageSize=1050) at nzaeremoteprotocol.c:478 #7 0xf7edd7e1 in nz::ae::NzaeRemoteProtocol::getLocalApi () at \ src/nzaeremoteprotocol.cpp:81 #8 0xf7eb4c0f in nz::ae::NzaeFactory::getLocalApi (this=0xf7f09444) at \ src/nzaefactory.cpp:67 #9 0x0804a2f1 in nz::ae::NzaeApiGenerator::getApi (this=0xffd08ba0, \ type=nz::ae::NzaeApi::FUNCTION, fork=false) \ at /nz/export/ae/adapters/cpp/3/sys/include/nzaeapigenerator.hpp:76 #10 0x0804ae18 in nz::ae::NzaeApiGenerator::getApi (this=0xffd08ba0, \ type=nz::ae::NzaeApi::FUNCTION) \ at /nz/export/ae/adapters/cpp/3/sys/include/nzaeapigenerator.hpp:63 #11 0x080492b2 in main () at applyopcpp.cpp:22 (gdb) n Single stepping until exit from function __kernel_vsyscall, which has no line number information. 0x0088b290 in __nanosleep_nocancel () from /lib/libc.so.6 (gdb) Single stepping until exit from function __nanosleep_nocancel, which has no line number information. 0x0088b0df in sleep () from /lib/libc.so.6 (gdb) Single stepping until exit from function sleep, which has no line number information. _nzaeCheckForSpinFile (spinFileName=0xffd0a7ff "/tmp/spin_ae") at nzaediagnostics.c:30 30 while (!stopLoopFlag) Current language: auto; currently c $1 = 1 (gdb) b applyopcpp.cpp:24 Breakpoint 1 at 0x80492c3: file applyopcpp.cpp, line 24. (gdb) c Continuing. [New Thread 0xf7e3ab90 (LWP 28647)] Breakpoint 1, main () at applyopcpp.cpp:24 24 if (!helper.isRemote()) Current language: auto; currently c++ (gdb) c Continuing. [Thread 0xf7e3ab90 (LWP 28647) exited] Program exited normally. (gdb) q
Remember to remove the spin file afterward of the next time it is run it will hang as well.