AE enabled (local AE)
You can use GDB when in local AE mode. In this case, add the GDB path to the AE by specifying NZAE_GDB_PATH when registering the AE, as well as by specifying the terminal. For example:
--environment "'NZAE_TERMINAL'='/dev/pts/4'" –environment \
"'NZAE_GDB_PATH'='/nz/kit/sbin/gcc/bin/gdb'"
You can set up debugging of the local AE by using the applyopcpp case (see code in the section C++ Language Scalar Function). Note that the --sig in register_ae has changed. Therefore, the SQL invocation should use apply instead of applyop_cpp to mirror the change to --sig. In addition, the --exe in compile_ae and register_ae have also changed.
- Add the GDB path to the
AE:
$NZ_EXPORT_DIR/ae/utilities/bin/compile_ae --language cpp --template compile \ --exe testapply --compargs "-g -Wall" --linkargs "-g" applyopcpp.cpp \ --version 3 $NZ_EXPORT_DIR/ae/utilities/bin/register_ae --language cpp --version 3 \ --template udf --sig "apply(varargs)" --return "double" \ --exe testapply --environment "'NZAE_TERMINAL'='/dev/pts/4'" \ --environment "'NZAE_GDB_PATH'='/nz/kit/sbin/gcc/bin/gdb'" - Add a stub for calling the function logic by doing the following step:
In the window that is associated with the terminal, run sleep 1000000 on the terminal to keep the shell running in that terminal from interfering with standard I/O.
When the SQL is run, it hangs because the debugger is active and you get the GDB prompt in the terminal window. You can then run normal GDB commands and nzsql waits until you exit from GDB, kill the sleep to get back to the shell prompt.
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"... (gdb) bt No stack. (gdb) b main Breakpoint 1 at 0x8049278: file applyopcpp.cpp, line 19. (gdb) c The program is not being run. (gdb) r Starting program: /nz/export/ae/applications/dev/admin/host/testapply [Thread debugging using libthread_db enabled] [New Thread 0xf7f0bad0 (LWP 28566)] Breakpoint 1, main () at applyopcpp.cpp:19 19 NzaeApiGenerator helper; (gdb) c Continuing. [New Thread 0xf7f0ab90 (LWP 28571)] in evaluate [Thread 0xf7f0ab90 (LWP 28571) exited] Program exited normally. (gdb) q