Re: [DynInst_API:] [PATCH] dyninstAPI: Find RT in existing libraries by fileDescriptor


Date: Thu, 22 May 2014 14:43:10 -0400
From: Francis Deslauriers <fdeslaur@xxxxxxxxx>
Subject: Re: [DynInst_API:] [PATCH] dyninstAPI: Find RT in existing libraries by fileDescriptor
This patch fixes my issue.

Thank you very much for the support!

Francis

On Thu, May 22, 2014 at 2:24 PM, Josh Stone <jistone@xxxxxxxxxx> wrote:
> When PCEventHandler::handleLibrary and PCProcess::setupForkedProcess try
> to match the RT library, they do so using fileDescriptors.  However, in
> PCProcess::createInitialMappedObjects it compared getAbsoluteName, which
> won't match if $DYNINSTAPI_RT_LIB was a symlink to the real binary.
>
> Now createInitialMappedObjects uses a fileDescriptor comparison too.
>
> Reported-by: Francis Deslauriers <fdeslaur@xxxxxxxxx>
> Signed-off-by: Josh Stone <jistone@xxxxxxxxxx>
> ---
>  dyninstAPI/src/dynProcess.C | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/dyninstAPI/src/dynProcess.C b/dyninstAPI/src/dynProcess.C
> index 9f11f54b7e69..bd08225ac56f 100644
> --- a/dyninstAPI/src/dynProcess.C
> +++ b/dyninstAPI/src/dynProcess.C
> @@ -674,7 +674,9 @@ bool PCProcess::createInitialMappedObjects() {
>             return false;
>         }
>
> -       if ((*i)->getAbsoluteName() == dyninstRT_name) {
> +       const fileDescriptor &desc = newObj->getFileDesc();
> +       fileDescriptor tmpDesc(dyninstRT_name, desc.code(), desc.data(), true);
> +       if( desc == tmpDesc ) {
>            startup_printf("%s[%d]: RT library already loaded, manual loading not necessary\n",
>                           FILE__, __LINE__);
>            runtime_lib.insert(newObj);
> --
> 1.9.0
>
[← Prev in Thread] Current Thread [Next in Thread→]