Skip to content

Commit

Permalink
tools/bashreadline: fix probe for dynamically linked readline
Browse files Browse the repository at this point in the history
When bash links against libreadline dynamically, the probe fails as the
readline symbol is undefined until runtime. Fix this issue by adding a
fallback probe that hooks directly into libreadline.

Signed-off-by: Anthony Iliopoulos <[email protected]>
  • Loading branch information
Anthony Iliopoulos authored and danobi committed Nov 3, 2024
1 parent 4207c82 commit f0f6d60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ and this project adheres to
- Remove mention of unsupported character literals
- [#3283](https://github.com/bpftrace/bpftrace/pull/3283)
#### Tools
- Fix bashreadline tool probe for dynamically linked readline
- [#3564](https://github.com/bpftrace/bpftrace/pull/3564)

## [0.21.0] 2024-06-21

Expand Down
6 changes: 5 additions & 1 deletion tools/bashreadline.bt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
* 06-Sep-2018 Brendan Gregg Created this.
*/

config = { missing_probes = "ignore" }

BEGIN
{
printf("Tracing bash commands... Hit Ctrl-C to end.\n");
printf("%-9s %-6s %s\n", "TIME", "PID", "COMMAND");
}

uretprobe:/bin/bash:readline
uretprobe:/bin/bash:readline,
uretprobe:libreadline:readline
/comm == "bash"/
{
time("%H:%M:%S ");
printf("%-6d %s\n", pid, str(retval));
Expand Down

0 comments on commit f0f6d60

Please sign in to comment.