Skip to content

runtime: add uprobe_multi support #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update
  • Loading branch information
Officeyutong committed Mar 24, 2024
commit ea450e57841320466bb0b01c627896d0ca6981e7
83 changes: 0 additions & 83 deletions runtime/src/attach/bpf_attach_ctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,89 +356,6 @@ bpf_attach_ctx::instantiate_perf_event_bpf_link_handler_at(
{ std::make_pair(attach_id, attach_impl) });
}

// int bpf_attach_ctx::instantiate_bpf_link_handler_at(
// int id, const bpf_link_handler &handler)
// {
// SPDLOG_DEBUG(
// "Instantiating link handler ({}): prog {} -> perf event count ({}), link_attach_type {}",
// id, handler.prog_id, handler.attach_target_ids.size(),
// handler.link_attach_type);

// auto prog = instantiated_progs.at(handler.prog_id).get();
// if (handler.link_attach_type == BPF_PERF_EVENT ||
// handler.link_attach_type == BPF_TRACE_UPROBE_MULTI) {
// std::vector<std::pair<int, attach::base_attach_impl *> >
// internal_attach_records;
// int i = 0;
// for (auto target_id : handler.attach_target_ids) {
// SPDLOG_DEBUG(
// "Handling sub attach target with target id {}, index {}",
// target_id, i);
// auto &[priv_data, attach_type] =
// instantiated_perf_events[target_id];
// SPDLOG_DEBUG(
// "Attach private data is {}, attach type is ",
// priv_data->to_string(), attach_type);
// attach::base_attach_impl *attach_impl;
// if (auto itr = attach_impls.find(attach_type);
// itr != attach_impls.end()) {
// attach_impl = itr->second.first;
// } else {
// SPDLOG_ERROR("Attach type {} is not registered",
// attach_type);
// return -ENOTSUP;
// }

// std::optional<uint64_t> cookie;
// if (std::holds_alternative<perf_event_link_data>(
// handler.data)) {
// cookie = std::get<perf_event_link_data>(
// handler.data)
// .attach_cookie;

// } else if (std::holds_alternative<uprobe_multi_link_data>(
// handler.data)) {
// cookie = std::get<uprobe_multi_link_data>(
// handler.data)
// .entries[i]
// .cookie;
// }
// if (cookie.has_value()) {
// SPDLOG_DEBUG("Attach cookie is {}",
// cookie.value());
// }
// int attach_id =
// attach_impl->create_attach_with_ebpf_callback(
// [=](void *mem, size_t mem_size,
// uint64_t *ret) -> int {
// current_thread_bpf_cookie =
// cookie;
// int err =
// prog->bpftime_prog_exec(
// (void *)mem,
// mem_size, ret);
// return err;
// },
// *priv_data, attach_type);
// if (attach_id < 0) {
// SPDLOG_ERROR(
// "Unable to instantiate bpf link handler {} (sub perf id {}): {}",
// id, target_id, attach_id);
// return attach_id;
// }
// internal_attach_records.emplace_back(attach_id,
// attach_impl);
// i++;
// }
// instantiated_attach_ids[id] = internal_attach_records;

// } else {
// SPDLOG_ERROR("We does not support link with attach type {} yet",
// handler.link_attach_type);
// return -ENOTSUP;
// }
// return 0;
// }
int bpf_attach_ctx::instantiate_perf_event_handler_at(
int id, const bpf_perf_event_handler &perf_handler)
{
Expand Down