Skip to content

uprobe_dup: new probe that duplicates an event to a second probe#1178

Open
funman wants to merge 1 commit into
Upipe:masterfrom
funman:master
Open

uprobe_dup: new probe that duplicates an event to a second probe#1178
funman wants to merge 1 commit into
Upipe:masterfrom
funman:master

Conversation

@funman

@funman funman commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Usage example:

  • FILE *f = fopen("log.txt", "w");
  • assert(f);
  • struct uprobe *uprobe_log = uprobe_stdio_alloc(NULL, f, loglevel);
  • uprobe_stdio_set_color(uprobe_log, true);
  • assert(uprobe_log != NULL);
  • uprobe_main = uprobe_stdio_alloc(NULL, stderr, loglevel);
    assert(uprobe_main != NULL);
  • uprobe_main = uprobe_dup_alloc(uprobe_main, uprobe_log, UPROBE_LOG);
  • assert(uprobe_main != NULL);
  • uprobe_release(uprobe_log);

To get both terminal output and file output (with colors)

Usage example:

+    FILE *f = fopen("log.txt", "w");
+    assert(f);
+    struct uprobe *uprobe_log = uprobe_stdio_alloc(NULL, f, loglevel);
+    uprobe_stdio_set_color(uprobe_log, true);
+    assert(uprobe_log != NULL);
+
     uprobe_main = uprobe_stdio_alloc(NULL, stderr, loglevel);
     assert(uprobe_main != NULL);
+    uprobe_main = uprobe_dup_alloc(uprobe_main, uprobe_log, UPROBE_LOG);
+    assert(uprobe_main != NULL);
+    uprobe_release(uprobe_log);

To get both terminal output and file output (with colors)

@nto nto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Can you add a test case?
  • Please fix the coding style so that function parameters are correctly aligned
  • Commit title should be in imperative style and comply with the 50/72 Rule (eg: uprobe_dup: duplicate an event to a second probe)
  • You may remove error handling from the example and use more helpful variable names (eg: file_output and term_output for each uprobe_stdio instance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants