Hi all.
I wrote little utility for debugging OpenLMI providers from start to
end.
I hope that utility will be useful for OpenLMI comunity.
What will you need:
Debug symbols of:
tog-pegasus
openlmi-tools
provider which you want to debug (openlmi-hardware in my example)
kernel
... (gdb will tell you about missing symbols)
Packages:
systemtap
gdb
gcc (for compiling userspace wrapper)
How to use:
(all steps are under root account with selinux disabled)
1) Stop tog-pegasus.
2) Compile wraprun:
# make wraprun
Place wraprun to your favorite place in filesystem.
3) Edit /usr/libexec/pegasus/cmpiLMI_Hardware-cimprovagt.
Add wraprun to begin of cimprovagt line.
Example:
#!/bin/sh
# ...
/tmp/wraprun /usr/libexec/pegasus/cimprovagt "$@"
4) Start stap script:
# stap -m attach_gdb ./attach-gdb.stp
5) Switch to another terminal.
6) Start pegasus.
7) Try to contact provider
8) Switch back to terminal with running stap command.
There should be gdb prompt.
9) Now in gdb:
# start: you are in cimprovagt context
(gdb) set follow-fork-mode child
(gdb) continue
(gdb) break LMI_ProcessorInitialize
(gdb) continue
# Now you should be inside provider context.
# You can debug provider from init to cleanup.
(gdb)
# You can disable catch exec
FAQ:
Q: What about gdbserver?
A: gdbserver (for now) doesn't support follow-fork-mode. But this
will change in (near?) future.
Have nice day
Robin Hack
PS: If you know better utility or howto, please don't hesitate and reply
to this mail.