return BPFProgTable({});
}
-BPFStackTable BPF::get_stack_table(const std::string& name) {
+BPFStackTable BPF::get_stack_table(const std::string& name,
+ bool use_debug_file,
+ bool check_debug_file_crc) {
TableStorage::iterator it;
if (bpf_module_->table_storage().Find(Path({bpf_module_->id(), name}), it))
- return BPFStackTable(it->second);
- return BPFStackTable({});
+ return BPFStackTable(it->second, use_debug_file, check_debug_file_crc);
+ return BPFStackTable({}, use_debug_file, check_debug_file_crc);
}
std::string BPF::get_uprobe_event(const std::string& binary_path,
BPFProgTable get_prog_table(const std::string& name);
- BPFStackTable get_stack_table(const std::string& name);
+ BPFStackTable get_stack_table(const std::string& name,
+ bool use_debug_file = true,
+ bool check_debug_file_crc = true);
StatusTuple open_perf_buffer(const std::string& name,
perf_reader_raw_cb cb,
* limitations under the License.
*/
+#include <linux/elf.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <cerrno>
return StatusTuple(0);
}
+BPFStackTable::BPFStackTable(const TableDesc& desc,
+ bool use_debug_file,
+ bool check_debug_file_crc)
+ : BPFTableBase<int, stacktrace_t>(desc) {
+ symbol_option_ = {
+ .use_debug_file = use_debug_file,
+ .check_debug_file_crc = check_debug_file_crc,
+ .use_symbol_type = (1 << STT_FUNC) | (1 << STT_GNU_IFUNC)
+ };
+}
+
BPFStackTable::~BPFStackTable() {
for (auto it : pid_sym_)
bcc_free_symcache(it.second, it.first);
if (pid < 0)
pid = -1;
if (pid_sym_.find(pid) == pid_sym_.end())
- pid_sym_[pid] = bcc_symcache_new(pid, nullptr);
+ pid_sym_[pid] = bcc_symcache_new(pid, &symbol_option_);
void* cache = pid_sym_[pid];
bcc_symbol symbol;
#include <vector>
#include "bcc_exception.h"
+#include "bcc_syms.h"
#include "bpf_module.h"
#include "libbpf.h"
#include "perf_reader.h"
class BPFStackTable : public BPFTableBase<int, stacktrace_t> {
public:
- BPFStackTable(const TableDesc& desc)
- : BPFTableBase<int, stacktrace_t>(desc) {}
+ BPFStackTable(const TableDesc& desc,
+ bool use_debug_file,
+ bool check_debug_file_crc);
~BPFStackTable();
std::vector<uintptr_t> get_stack_addr(int stack_id);
std::vector<std::string> get_stack_symbol(int stack_id, int pid);
private:
+ bcc_symbol_option symbol_option_;
std::map<int, void*> pid_sym_;
};
#include "syms.h"
#include "vendor/tinyformat.hpp"
-#ifndef STT_GNU_IFUNC
-#define STT_GNU_IFUNC 10
-#endif
-
ino_t ProcStat::getinode_() {
struct stat s;
return (!stat(procfs_.c_str(), &s)) ? s.st_ino : -1;
typedef int (*SYM_CB)(const char *symname, uint64_t addr);
+#ifndef STT_GNU_IFUNC
+#define STT_GNU_IFUNC 10
+#endif
static const uint32_t BCC_SYM_ALL_TYPES = 65535;
struct bcc_symbol_option {
int use_debug_file;