Attach (remote AE)
Attaching works for remote AE mode. In this case you register the remote AE and the remote AE launcher:
- Register the remote
AE:
$NZ_EXPORT_DIR/ae/utilities/bin/register_ae --language cpp --version 3 \ --db dev --template udf --sig "apply(varargs)" --return "double" \ --exe testapply --rname testcapi –-remote - Register the remote AE
launcher:
$NZ_EXPORT_DIR/ae/utilities/bin/register_ae --language cpp --version 3 \ --db dev --template udtf --sig "launch_apply(int8)" \ --return "TABLE(aeresult varchar(255))" --exe testapply --rname testcapi \ --remote –launch - Launch the remote AE:
SELECT * FROM TABLE WITH FINAL(launch_apply(0)); AERESULT ------------------------------------------------------------------------ tran: 16310 session: 17244 DATA slc: 0 hardware: 0 machine: bdrosendev process: 31041 thread: 31041 (1 row) - Then attach it in another
window:
[nz@bdrosendev src]$ gdb /nz/export/ae/applications/dev/admin/host/testapply 31041 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 31041 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 0xf7e60ad0 (LWP 31041)] 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 0x009756c1 in accept () from /lib/libpthread.so.0 #2 0xf7ea117c in _nzaeCommGetServerAccept (sock=3, sockResult=0xffa2def4) \ at ../nzaeparent/nzaecommunication_impl.h:259 #3 0xf7ea534c in acceptEnvironment (handle=0x85bc190, result=0xffa2df68, \ timeoutMilliseconds=-1) at nzaeremoteprotocol.c:266 #4 0xf7ea5b1b in nzaeRemprotAcceptEnvironment (handle=0x85bc190, \ result=0xffa2df68) at nzaeremoteprotocol.c:438 #5 0xf7ea51c2 in nzaeRemprotAcceptApi (handle=0x85bc190, result=0xffa2dfb4) \ at nzaeremoteprotocol.c:216 #6 0xf7f024f8 in nz::ae::NzaeRemoteProtocolImpl::acceptConnection \ (this=0x85bc180) at src/nzaeremoteprotocol.cpp:119 #7 0x0804aa7a in nz::ae::NzaeApiGenerator::getApi (this=0xffa2e100, \ type=nz::ae::NzaeApi::FUNCTION, fork=false) \ at /nz/export/ae/adapters/cpp/3/sys/include/nzaeapigenerator.hpp:137 #8 0x0804ae18 in nz::ae::NzaeApiGenerator::getApi (this=0xffa2e100, \ type=nz::ae::NzaeApi::FUNCTION) at /nz/export/ae/adapters/cpp/3/sys/include/nzaeapigenerator.hpp:63 #9 0x080492b2 in main () at applyopcpp.cpp:22 (gdb) b applyopcpp.cpp:23 Breakpoint 1 at 0x80492b5: file applyopcpp.cpp, line 23. (gdb) c Continuing. - Then run the remote AE. At this point the BDG hits the et
breakpoint:
Breakpoint 1, main () at applyopcpp.cpp:23 23 run(api.aeFunction); (gdb) c Continuing.
Because this is a remote AE that has been coded to handle more than one remote connection, the GDB session is still active after the SQL returns. If you are using remote AE and forking a process for each request, the GDB fork mode must be set to debug the parent or child request with GDB command:
set follow-fork-mode <mode> (where mode can be parent, child, or ask)