Skip to content

Commit d3aef49

Browse files
committed
rust samples update
1 parent ca4e684 commit d3aef49

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

agent/src/ebpf/samples/rust/socket-tracer/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ lazy_static = "1.4.0"
2121
log = "0.4"
2222
env_logger = "0.9"
2323
trace-utils = { path = "../../../../../crates/trace-utils" }
24+
# Enable this option when building the Enterprise edition.
25+
# trace-utils-interp = { path = "../../../../../crates/trace-utils-interp" }

agent/src/ebpf/samples/rust/socket-tracer/src/main.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ use std::thread;
2828
use std::time::{Duration, UNIX_EPOCH};
2929
use log::info;
3030

31+
// Reference trace-utils-interp when building the Enterprise edition.
32+
// The purpose is to ensure that Rust links against libtrace_utils_interp-xxxx.rlib
33+
// during the linking stage.
34+
//
35+
// interpreter_tracer.c calls is_php_process(),
36+
// and this function is defined in the trace-utils-interp crate.
37+
//
38+
// However, the Rust code in socket_tracer does not directly reference
39+
// trace-utils-interp. As a result, Cargo considers this dependency unused
40+
// and excludes it from the linking stage.
41+
//
42+
// Therefore, we explicitly reference trace-utils-interp here to force
43+
// Cargo to include it in the final link.
44+
//use trace_utils_interp as _;
45+
3146
extern "C" {
3247
fn print_uprobe_http2_info(data: *mut c_char, len: c_uint);
3348
fn print_uprobe_grpc_dataframe(data: *mut c_char, len: c_uint);

0 commit comments

Comments
 (0)