Hi,
I was just digging back in my mail for a feature I can't find...
On 05/10/2012 02:36 PM, Andrew Bernat wrote:
>> This is fine. I think we'll also want a callback for dlopen/dlclose
>> type of events, so one can see objects that come and go.
>
> Right now there's a callback that hands you a BPatch_module; I need to
> add some sort of "get object from module" upcall.
Maybe I'm just missing it, but I think this was forgotten. It's a
simple thing to implement though, as in the attached patch.
Thanks,
Josh
>From 19bed8b4668f1e4ef3904a5fd38c8b9c45648c2d Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@xxxxxxxxxx>
Date: Fri, 28 Sep 2012 11:47:48 -0700
Subject: [PATCH] Add BPatch_module::getObject, returning its BPatch_object
---
dyninstAPI/h/BPatch_module.h | 7 +++++++
dyninstAPI/src/BPatch_module.C | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/dyninstAPI/h/BPatch_module.h b/dyninstAPI/h/BPatch_module.h
index 1f06ce9..d76dd0f 100644
--- a/dyninstAPI/h/BPatch_module.h
+++ b/dyninstAPI/h/BPatch_module.h
@@ -58,6 +58,7 @@ class AddressSpace;
class BPatch_snippet;
class BPatchSnippetHandle;
class BPatch_module;
+class BPatch_object;
namespace Dyninst {
namespace ParseAPI {
@@ -137,6 +138,12 @@ public:
bool remove(instPoint*);
// End functions for internal use only
+ // BPatch_module::getObject
+ // Returns the BPatch_object containing this module
+ API_EXPORT(Int, (),
+
+ BPatch_object *,getObject,());
+
// BPatch_module::getName
// Returns file name associated with module
API_EXPORT(Int, (buffer, length),
diff --git a/dyninstAPI/src/BPatch_module.C b/dyninstAPI/src/BPatch_module.C
index 3fe51af..7d1dc0f 100644
--- a/dyninstAPI/src/BPatch_module.C
+++ b/dyninstAPI/src/BPatch_module.C
@@ -90,6 +90,14 @@ BPatch_sourceObj *BPatch_module::getObjParent()
return (BPatch_sourceObj *) img;
}
+BPatch_object *BPatch_module::getObjectInt()
+{
+ if (!isValid())
+ return NULL;
+
+ return img->findOrCreateObject(mod->obj());
+}
+
char *BPatch_module::getNameInt(char *buffer, int length)
{
if (!mod)
--
1.7.11.4
|