Vladimir's IBM AIX notes
From BeSTGRID
Various notes on AIX specific topics:
Contents |
[edit] Using dbx debugger
- Start debugger with
dbx executable
If a core file exists in the current directory, dbx will automatically pick it up and start a post mortem analysis.
- Pass program arguments to the run command inside dbx:
(dbx) run --version
- See the stack trace (gdb bt command) with
(dbx) where
- Set a breakpoint to a function with:
(dbx) stop in processResponse
- Set a breakpoint to a line number with stop at ["filename":]linenr:
(dbx) stop at "prima_saml_support.cpp":330
- Move in the stack with frame 0-n
(dbx) frame 2
- Quit the debugger with quit
(dbx) quit
[edit] Linking dynamic libraries
To test how to make (shared object) libraries:
- Preliminaries: I have a program (usemylib.c) using a library (mylibfunc.c) with a function (print_hello) advertised in a header file (mylibfunc.h). Compile the program and the library into object files:
- Link a program with an object file:
xlc -o usemylib-static-o usemylib.o mylibfunc.o
- Create a static library, link a program with the library
ar -rv libmylibfunc-static.a mylibfunc.o xlc -o usemylib-static-lib usemylib.o -L . -lmylibfunc-static
- Create a shared object, link a program agains the shared object
xlc -o mylibfunc-shr.o -qmkshrobj mylibfunc.o
xlc -o usemylib-shr-o usemylib.o mylibfunc-shr.o
export LD_LIBRARY_PATH=.
export LIBPATH=.
./usemylib-shr-o # needs mylibfunc-shr.o to run
ldd usemylib-shr-o
>> usemylib-shr-o needs:
/usr/lib/libc.a(shr.o)
./mylibfunc-shr.o
/unix
/usr/lib/libcrypt.a(shr.o)
- Note that even though to run the program, it works to either set LD_LIBRARY_PATH or LIBPATH, ldd only picks LIBPATH and otherwise prints Cannot find for each missing library or object file.
- Create a shared library - reuse shared object created in previous step
ar -rv libmylibfunc-shr.a mylibfunc-shr.o
xlc -o usemylib-shr-lib usemylib.o -L . -lmylibfunc-shr
./usemylib-shr-lib # needs libmylibfunc-shr.a
ldd usemylib-shr-lib
>> usemylib-shr-lib needs:
/usr/lib/libc.a(shr.o)
./libmylibfunc-shr.a(mylibfunc-shr.o)
/unix
/usr/lib/libcrypt.a(shr.o)
- Alternatively with makeC++SharedLib: note that this wrapper script creates an Object, not a library - it's an quivalent to creating a shared object two steps above.
makeC++SharedLib -o mylibfunc-shr-cpp.o -p 0 mylibfunc.o -L /usr/vac/lib xlc -o usemylib-shr-o-cpp usemylib.o mylibfunc-shr-cpp.o
[edit] Running interactive LoadLeveler jobs
poe ./prog.exe –llfile ./llfile
[edit] Starting sendmail as an AIX service
The startsrc command does not know any default arguments to the service and they must be explicitly passed. For sendmail, this is:
startsrc -s sendmail -a "-bd -q30m"
