LD_PRELOAD related question - Linux

This is a discussion on LD_PRELOAD related question - Linux ; Hi, This question might sound weird but its a long story why I want to do this. I sometimes run my app with a profiling agent 'pre-loaded'. For example: $ env LD_PRELOAD=profiling_agent.so my_app My question: Inside 'my_app', I want to ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: LD_PRELOAD related question

  1. LD_PRELOAD related question

    Hi,

    This question might sound weird but its a long story why I want to do
    this.

    I sometimes run my app with a profiling agent 'pre-loaded'. For
    example:

    $ env LD_PRELOAD=profiling_agent.so my_app

    My question: Inside 'my_app', I want to know if 'profiling_agent.so'
    is running/pre-loaded or not. Can I find out via the /proc interface?


    Regards
    Rajesh

  2. Re: LD_PRELOAD related question

    Rajesh writes:

    > Hi,
    >
    > This question might sound weird but its a long story why I want to do
    > this.
    >
    > I sometimes run my app with a profiling agent 'pre-loaded'. For
    > example:
    >
    > $ env LD_PRELOAD=profiling_agent.so my_app
    >
    > My question: Inside 'my_app', I want to know if 'profiling_agent.so'
    > is running/pre-loaded or not. Can I find out via the /proc interface?


    On Linux, /proc/self/maps should contain this information.

    --
    Måns Rullgård
    mans@mansr.com

  3. Re: LD_PRELOAD related question

    Måns Rullgård writes:

    >> $ env LD_PRELOAD=profiling_agent.so my_app
    >>
    >> My question: Inside 'my_app', I want to know if 'profiling_agent.so'
    >> is running/pre-loaded or not. Can I find out via the /proc interface?

    >
    > On Linux, /proc/self/maps should contain this information.


    True, but a much easier way to find out whether profiling_agent.so is
    preloaded is by *not* using /proc interface. Use a weak unresolved symbol
    in my_app, for a symbol defined in the profiling_agent.so instead.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

+ Reply to Thread