Advertisement
Guest User

Untitled

a guest
Dec 18th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.88 KB | None | 0 0
  1. diff --git a/runtime/linux/debug.h b/runtime/linux/debug.h
  2. index 6ac9d3113..e23ee96e7 100644
  3. --- a/runtime/linux/debug.h
  4. +++ b/runtime/linux/debug.h
  5. @@ -56,6 +56,14 @@
  6.  #define dbug_otf(args...) ;
  7.  #endif
  8.  
  9. +#ifdef DEBUG_UPROBES
  10. +#define dbug_uprobes(args...) do {                     \
  11. +       _stp_dbug(__FUNCTION__, __LINE__, args);        \
  12. +   } while (0)
  13. +#else
  14. +#define dbug_uprobes(args...) ;
  15. +#endif
  16. +
  17.  #ifdef DEBUG_UNWIND /* stack unwinder */
  18.  #define dbug_unwind(level, args...) do {                   \
  19.         if ((level) <= DEBUG_UNWIND)                \
  20. diff --git a/runtime/linux/uprobes-inode.c b/runtime/linux/uprobes-inode.c
  21. index b9604e638..48eb75894 100644
  22. --- a/runtime/linux/uprobes-inode.c
  23. +++ b/runtime/linux/uprobes-inode.c
  24. @@ -365,8 +365,15 @@ stapiu_target_unreg(struct stapiu_target *target)
  25.     if (! target->inode)
  26.         return;
  27.     list_for_each_entry(c, &target->consumers, target_consumer) {
  28. -       if (c->registered)
  29. +       if (c->registered) {
  30. +           dbug_uprobes("unregistering (u%sprobe) inode-offset "
  31. +                    "%lu:%p pidx %zu\n",
  32. +                    c->return_p ? "ret" : "",
  33. +                    (unsigned long) target->inode->i_ino,
  34. +                    (void*) (uintptr_t) c->offset,
  35. +                    c->probe->index);
  36.             stapiu_unregister(target->inode, c);
  37. +       }
  38.     }
  39.  }
  40.  
  41. @@ -386,14 +393,30 @@ stapiu_target_reg(struct stapiu_target *target, struct task_struct* task)
  42.                 _stp_perf_read_init ((c->perf_counters)[i], task);
  43.             }
  44.             if (!c->probe->cond_enabled) {
  45. -               dbug_otf("not registering (u%sprobe) pidx %zu\n",
  46. -                    c->return_p ? "ret" : "", c->probe->index);
  47. +               dbug_uprobes("not registering (u%sprobe) "
  48. +                        "inode-offset %lu:%p pidx %zu\n",
  49. +                        c->return_p ? "ret" : "",
  50. +                        (unsigned long)
  51. +                       target->inode->i_ino,
  52. +                        (void*) (uintptr_t) c->offset,
  53. +                        c->probe->index);
  54.                 continue;
  55.             }
  56. +           dbug_uprobes("registering (u%sprobe) at inode-offset "
  57. +                    "%lu:%p pidx %zu\n",
  58. +                    c->return_p ? "ret" : "",
  59. +                    (unsigned long) target->inode->i_ino,
  60. +                    (void*) (uintptr_t) c->offset,
  61. +                    c->probe->index);
  62. +
  63.             ret = stapiu_register(target->inode, c);
  64.             if (ret != 0)
  65. -               _stp_warn("probe %s inode-offset %p registration error (rc %d)",
  66. -                     c->probe->pp, (void*) (uintptr_t) c->offset, ret);
  67. +               _stp_warn("probe %s at inode-offset %lu:%p "
  68. +                     "registration error (rc %d)",
  69. +                     c->probe->pp,
  70. +                     (unsigned long) target->inode->i_ino,
  71. +                     (void*) (uintptr_t) c->offset,
  72. +                     ret);
  73.         }
  74.     }
  75.     if (ret)
  76. @@ -415,18 +438,32 @@ stapiu_target_refresh(struct stapiu_target *target)
  77.         // should we unregister it?
  78.         if (c->registered && !c->probe->cond_enabled) {
  79.  
  80. -           dbug_otf("unregistering (u%sprobe) pidx %zu\n",
  81. -                c->return_p ? "ret" : "", c->probe->index);
  82. +           dbug_uprobes("unregistering (u%sprobe) at inode-offset "
  83. +                    "%lu:%p pidx %zu\n",
  84. +                    c->return_p ? "ret" : "",
  85. +                    (unsigned long) target->inode->i_ino,
  86. +                    (void*) (uintptr_t) c->offset,
  87. +                    c->probe->index);
  88.             stapiu_unregister(target->inode, c);
  89.  
  90.         // should we register it?
  91.         } else if (!c->registered && c->probe->cond_enabled) {
  92.  
  93. -           dbug_otf("registering (u%sprobe) pidx %zu\n",
  94. -                c->return_p ? "ret" : "", c->probe->index);
  95. +           dbug_uprobes("registering (u%sprobe) at inode-offset "
  96. +                    "%lu:%p pidx %zu\n",
  97. +                    c->return_p ? "ret" : "",
  98. +                    (unsigned long) target->inode->i_ino,
  99. +                    (void*) (uintptr_t) c->offset,
  100. +                    c->probe->index);
  101. +
  102.             if (stapiu_register(target->inode, c) != 0)
  103. -               dbug_otf("couldn't register (u%sprobe) pidx %zu\n",
  104. -                    c->return_p ? "ret" : "", c->probe->index);
  105. +               dbug_uprobes("couldn't register (u%sprobe) "
  106. +                        "inode-offset %lu:%p pidx %zu\n",
  107. +                        c->return_p ? "ret" : "",
  108. +                        (unsigned long)
  109. +                       target->inode->i_ino,
  110. +                        (void*) (uintptr_t) c->offset,
  111. +                        c->probe->index);
  112.         }
  113.     }
  114.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement