Commit cf130834 authored by Teng Qin's avatar Teng Qin

Do not pass type flag to symbol callback

As the symbol type check now controled by the specified
`bcc_symbol_option` and handled in lower level, there is not need to
pass the type flag to the callback anymore.
parent 89d901c6
......@@ -182,7 +182,7 @@ static int list_in_scn(Elf *e, Elf_Scn *section, size_t stridx, size_t symsize,
if (!(option->use_symbol_type & flag))
continue;
if (callback(name, sym.st_value, sym.st_size, sym.st_info, payload) < 0)
if (callback(name, sym.st_value, sym.st_size, payload) < 0)
return 1; // signal termination to caller
}
}
......
......@@ -34,7 +34,9 @@ struct bcc_elf_usdt {
typedef void (*bcc_elf_probecb)(const char *, const struct bcc_elf_usdt *,
void *);
typedef int (*bcc_elf_symcb)(const char *, uint64_t, uint64_t, int, void *);
// Symbol name, start address, length, payload
typedef int (*bcc_elf_symcb)(const char *, uint64_t, uint64_t, void *);
int bcc_elf_foreach_usdt(const char *path, bcc_elf_probecb callback,
void *payload);
......
......@@ -109,7 +109,7 @@ int bcc_perf_map_foreach_sym(const char *path, bcc_perf_map_symcb callback,
if (newline)
newline[0] = '\0';
callback(cursor, begin, len, 0, payload);
callback(cursor, begin, len, payload);
}
free(line);
......
......@@ -24,8 +24,8 @@ extern "C" {
#include <stdbool.h>
#include <unistd.h>
typedef int (*bcc_perf_map_symcb)(const char *, uint64_t, uint64_t, int,
void *);
// Symbol name, start address, length, payload
typedef int (*bcc_perf_map_symcb)(const char *, uint64_t, uint64_t, void *);
bool bcc_is_perf_map(const char *path);
......
......@@ -290,10 +290,10 @@ bool ProcSyms::Module::init() {
}
int ProcSyms::Module::_add_symbol(const char *symname, uint64_t start,
uint64_t end, int flags, void *p) {
uint64_t size, void *p) {
Module *m = static_cast<Module *>(p);
auto res = m->symnames_.emplace(symname);
m->syms_.emplace_back(&*(res.first), start, end, flags);
m->syms_.emplace_back(&*(res.first), start, size);
return 0;
}
......@@ -450,8 +450,8 @@ int bcc_resolve_global_addr(int pid, const char *module, const uint64_t address,
return 0;
}
static int _sym_cb_wrapper(const char *symname, uint64_t addr, uint64_t end,
int flags, void *payload) {
static int _sym_cb_wrapper(const char *symname, uint64_t addr, uint64_t,
void *payload) {
SYM_CB cb = (SYM_CB) payload;
return cb(symname, addr);
}
......@@ -470,8 +470,8 @@ int bcc_foreach_function_symbol(const char *module, SYM_CB cb) {
module, _sym_cb_wrapper, &default_option, (void *)cb);
}
static int _find_sym(const char *symname, uint64_t addr, uint64_t end,
int flags, void *payload) {
static int _find_sym(const char *symname, uint64_t addr, uint64_t,
void *payload) {
struct bcc_symbol *sym = (struct bcc_symbol *)payload;
if (!strcmp(sym->name, symname)) {
sym->offset = addr;
......
......@@ -98,12 +98,11 @@ private:
class ProcSyms : SymbolCache {
struct Symbol {
Symbol(const std::string *name, uint64_t start, uint64_t size, int flags = 0)
: name(name), start(start), size(size), flags(flags) {}
Symbol(const std::string *name, uint64_t start, uint64_t size)
: name(name), start(start), size(size) {}
const std::string *name;
uint64_t start;
uint64_t size;
int flags;
bool operator<(const struct Symbol& rhs) const {
return start < rhs.start;
......@@ -144,8 +143,8 @@ class ProcSyms : SymbolCache {
bool find_addr(uint64_t offset, struct bcc_symbol *sym);
bool find_name(const char *symname, uint64_t *addr);
static int _add_symbol(const char *symname, uint64_t start, uint64_t end,
int flags, void *p);
static int _add_symbol(const char *symname, uint64_t start, uint64_t size,
void *p);
};
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