Commit b5e68221 authored by Alastair Robertson's avatar Alastair Robertson

Use std::strings rather than C-strings

parent e25f0498
......@@ -320,14 +320,14 @@ void CodegenLLVM::visit(Call &call)
{
uint64_t addr;
auto &name = static_cast<String&>(*call.vargs->at(0)).str;
addr = bpftrace_.resolve_kname(name.c_str());
addr = bpftrace_.resolve_kname(name);
expr_ = b_.getInt64(addr);
}
else if (call.func == "uaddr")
{
uint64_t addr;
auto &name = static_cast<String&>(*call.vargs->at(0)).str;
addr = bpftrace_.resolve_uname(name.c_str(), current_attach_point_->target.c_str());
addr = bpftrace_.resolve_uname(name, current_attach_point_->target);
expr_ = b_.getInt64(addr);
}
else if (call.func == "join")
......
......@@ -1248,7 +1248,7 @@ std::string BPFtrace::resolve_sym(uintptr_t addr, bool show_offset)
return symbol.str();
}
uint64_t BPFtrace::resolve_kname(const char *name)
uint64_t BPFtrace::resolve_kname(const std::string &name)
{
uint64_t addr = 0;
std::string file_name = "/proc/kallsyms";
......@@ -1282,7 +1282,7 @@ uint64_t BPFtrace::resolve_kname(const char *name)
return addr;
}
uint64_t BPFtrace::resolve_uname(const char *name, const char *path)
uint64_t BPFtrace::resolve_uname(const std::string &name, const std::string &path)
{
uint64_t addr = 0;
......
......@@ -62,8 +62,8 @@ public:
std::string resolve_sym(uintptr_t addr, bool show_offset=false);
std::string resolve_usym(uintptr_t addr, int pid, bool show_offset=false);
std::string resolve_uid(uintptr_t addr);
uint64_t resolve_kname(const char *name);
uint64_t resolve_uname(const char *name, const char *path);
uint64_t resolve_kname(const std::string &name);
uint64_t resolve_uname(const std::string &name, const std::string &path);
std::string resolve_name(uint64_t name_id);
std::vector<uint64_t> get_arg_values(std::vector<Field> args, uint8_t* arg_data);
int pid_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment