[ktap] [PATCH 2/2] uprobes: fix calling of write_uprobe_event() with NO_LIBELF

  • From: Azat Khuzhin <a3at.mail@xxxxxxxxx>
  • To: ktap@xxxxxxxxxxxxx
  • Date: Sun, 17 Nov 2013 01:16:44 +0400

After 21bbbbf6c7a3f94583b0660b5db33870b6d1232e ("Support uprobe/sdt
symbol glob match completely") write_uprobe_event() accept symbol name,
so we need to give it.
While we don't have libelf, just pass address in hex as string.

Signed-off-by: Azat Khuzhin <a3at.mail@xxxxxxxxx>
---
 userspace/eventdef.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/userspace/eventdef.c b/userspace/eventdef.c
index ebb1679..04add30 100644
--- a/userspace/eventdef.c
+++ b/userspace/eventdef.c
@@ -417,11 +417,14 @@ static int parse_events_resolve_symbol(int fd, char 
*event, int type)
         * We already have address, no need in resolving.
         */
        if (symbol_address) {
+               char symbol[128] = {0};
                int ret;
 
                binary = strndup(event, colon - event);
+               sprintf(symbol, "%lx", symbol_address);
+
                ret = write_uprobe_event(fd, !!strstr(event, "%return"), binary,
-                                        symbol_address);
+                                        symbol, symbol_address);
                free(binary);
                return ret;
        }
-- 
1.8.4.rc3


Other related posts: