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
|