Operating System - HP-UX
1752777 Members
5900 Online
108789 Solutions
New Discussion юеВ

Re: Debugging Output of Dynamic Loader

 
SOLVED
Go to solution
Andre-Marcel Hellmund
Frequent Advisor

Debugging Output of Dynamic Loader

Hey,

is there a way in HP-UX to get debugging output of the dynamic loader about what he is doing (e.g. which undefined symbols are bound to which shared libraries)? I know that there is a possibility for the dl_open call to request verbose output, but I am looking for a more general debug output comparable to the one of Linux (LD_DEBUG/LD_DEBUG_OUTPUT).

Thanks for your answers,
Andre-Marcel
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor

Re: Debugging Output of Dynamic Loader

Hi:

Does the linker's '-B nonfatal -B verbose' help you?

http://docs.hp.com/en/B3921-60631/ld_ia.1.html

http://docs.hp.com/en/B3921-60631/ld_pa.1.html

Regards!

...JRF...
Andre-Marcel Hellmund
Frequent Advisor

Re: Debugging Output of Dynamic Loader

Hey,

that might be the information I searched for :) I tried this linker option with a short test program but did not get any output. (verbose: Display verbose messages when binding symbols. This is the default ...)

Do I have to set an additional environment variable or is this output written to a log file instead of to stdout?

Thx,
Andre-Marcel
Dennis Handly
Acclaimed Contributor

Re: Debugging Output of Dynamic Loader

What are you trying to debug? The application startup or a dlopen call?
Is this PA32 or everything else?

For the startup, you can use "ldd -r -s executable". There is also -v.

If you are using dlopen, you can use dlerror.
Otherwise you should give up on dlopen and use the tried and true shl_load with BIND_VERBOSE.

There is _HP_DLDOPTS but all I see is -warnings.

>is this output written to a log file instead of to stdout?

It should be sent to stderr.
Andre-Marcel Hellmund
Frequent Advisor

Re: Debugging Output of Dynamic Loader

> What are you trying to debug? The application startup or a dlopen call? Is this PA32 or everything else?

Primarily the application startup on IA64.

> For the startup, you can use "ldd -r -s executable". There is also -v.

The information given by "ldd -r -s -v ..." is quite good, but I was/am looking for a debug output based on symbols as in the case of Linux:

A simple test program with just printf and the LD_DEBUG set to "bindings,symbols" would yield:

symbol=printf; lookup in file=./main [0]
symbol=printf; lookup in file=/lib/tls/i686/nosegneg/libc.so.6 [0]

binding file ./main [0] to /lib/tls/i686/nosegneg/libc.so.6 [0]: normal symbol `printf' [GLIBC_2.0]


I would also be satisfied with a "No, it is not possible in that detail on HP-UX without a debugging dld.so"
Dennis Handly
Acclaimed Contributor

Re: Debugging Output of Dynamic Loader

>I would also be satisfied with a "No, it is not possible in that detail on HP-UX without a debugging dld.so"

That's probably true for dld.so.
But you can use my tool instead. See the attachment show_remaining_imports_elf.sh in this thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1261297
Andre-Marcel Hellmund
Frequent Advisor

Re: Debugging Output of Dynamic Loader

Thanks for your answers.
ranganath ramachandra
Esteemed Contributor
Solution

Re: Debugging Output of Dynamic Loader

you can use the ldd tool with the "-y" flag. "ldd -y " will give you details of all the symbol resolutions. if you want details for only one symbol, you can specify the symbol name with "-y,".

example in attached file.
 
--
ranga
[i work for hpe]

Accept or Kudo

Andre-Marcel Hellmund
Frequent Advisor

Re: Debugging Output of Dynamic Loader

Hey,

thanks! That's what I was looking for!