Skip to content
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

Update blazesym snapshot and profile example #205

Merged
merged 6 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion blazesym
Submodule blazesym updated 72 files
+1 −1 .cargo/config
+9 −0 .cargo/runner.sh
+26 −0 .github/workflows/build.yml
+49 −8 .github/workflows/test.yml
+48 −0 CHANGELOG.md
+40 −18 Cargo.toml
+19 −6 README.md
+27 −4 benches/inspect.rs
+18 −2 benches/main.rs
+4 −4 benches/normalize.rs
+64 −18 benches/symbolize.rs
+127 −54 build.rs
+1 −0 cli/.cargo
+24 −0 cli/Cargo.toml
+60 −0 cli/README.md
+18 −0 cli/build.rs
+86 −0 cli/src/args.rs
+101 −0 cli/src/main.rs
+33 −0 cli/var/shell-complete.rs
+9 −0 codecov.yml
+ data/dwarf-example
+1 −1 data/test-stable-addresses.c
+38 −14 examples/addr2ln.rs
+37 −19 examples/addr2ln_pid.rs
+84 −0 examples/backtrace.rs
+133 −33 include/blazesym.h
+29 −3 src/c_api/inspect.rs
+228 −43 src/c_api/normalize.rs
+201 −36 src/c_api/symbolize.rs
+0 −64 src/dwarf/constants.rs
+0 −896 src/dwarf/debug_info.rs
+318 −0 src/dwarf/function.rs
+54 −0 src/dwarf/lazy.rs
+163 −0 src/dwarf/lines.rs
+159 −0 src/dwarf/location.rs
+8 −5 src/dwarf/mod.rs
+0 −1,100 src/dwarf/parser.rs
+89 −0 src/dwarf/range.rs
+31 −0 src/dwarf/reader.rs
+179 −151 src/dwarf/resolver.rs
+161 −0 src/dwarf/unit.rs
+491 −0 src/dwarf/units.rs
+24 −24 src/elf/cache.rs
+2 −0 src/elf/mod.rs
+236 −168 src/elf/parser.rs
+47 −27 src/elf/resolver.rs
+9 −0 src/elf/types.rs
+680 −0 src/error.rs
+29 −3 src/gsym/linetab.rs
+35 −73 src/gsym/parser.rs
+174 −102 src/gsym/resolver.rs
+4 −7 src/gsym/types.rs
+13 −4 src/inspect/inspector.rs
+1 −0 src/inspect/mod.rs
+19 −35 src/kernel.rs
+56 −34 src/ksym.rs
+31 −9 src/lib.rs
+81 −18 src/maps.rs
+17 −7 src/mmap.rs
+214 −0 src/normalize/buildid.rs
+105 −9 src/normalize/meta.rs
+24 −8 src/normalize/mod.rs
+115 −413 src/normalize/normalizer.rs
+492 −0 src/normalize/user.rs
+28 −6 src/resolver.rs
+62 −33 src/symbolize/mod.rs
+114 −17 src/symbolize/source.rs
+286 −84 src/symbolize/symbolizer.rs
+93 −106 src/util.rs
+58 −39 src/zip.rs
+194 −27 tests/blazesym.rs
+96 −64 tests/c_api.rs
30 changes: 17 additions & 13 deletions examples/c/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,36 @@ static void show_stack_trace(__u64 *stack, int stack_sz, pid_t pid)

for (i = 0; i < stack_sz; i++) {
if (!result || result->size <= i || !result->entries[i].size) {
printf(" %d [<%016llx>]\n", i, stack[i]);
printf(" %2d [<%016llx>]\n", i, stack[i]);
continue;
}

if (result->entries[i].size == 1) {
sym = &result->entries[i].syms[0];
if (sym->path && sym->path[0]) {
printf(" %d [<%016llx>] %s+0x%llx %s:%ld\n", i, stack[i],
sym->symbol, stack[i] - sym->addr, sym->path,
sym->line);

if (sym->dir && sym->dir[0] != '\0' && sym->file && sym->file[0] != '\0') {
printf(" %2d [<%016llx>] %s+0x%lx %s/%s:%u\n", i, stack[i],
sym->name, sym->offset, sym->dir, sym->file, sym->line);
} else if (sym->file && sym->file[0] != '\0') {
printf(" %2d [<%016llx>] %s+0x%lx %s:%u\n", i, stack[i],
sym->name, sym->offset, sym->file, sym->line);
} else {
printf(" %d [<%016llx>] %s+0x%llx\n", i, stack[i], sym->symbol,
stack[i] - sym->addr);
printf(" %2d [<%016llx>] %s+0x%lx\n", i, stack[i], sym->name, sym->offset);
}
continue;
}

printf(" %d [<%016llx>]\n", i, stack[i]);
printf(" %2d [<%016llx>]\n", i, stack[i]);
for (j = 0; j < result->entries[i].size; j++) {
sym = &result->entries[i].syms[j];
if (sym->path && sym->path[0]) {
printf(" %s+0x%llx %s:%ld\n", sym->symbol,
stack[i] - sym->addr, sym->path, sym->line);
if (sym->dir && sym->dir[0] != '\0' && sym->file && sym->file[0] != '\0') {
printf(" %s+0x%lx %s/%s:%u\n", sym->name,
sym->offset, sym->dir, sym->file, sym->line);
} else if (sym->file && sym->file[0] != '\0') {
printf(" %s+0x%lx %s:%u\n", sym->name,
sym->offset, sym->file, sym->line);
} else {
printf(" %s+0x%llx\n", sym->symbol,
stack[i] - sym->addr);
printf(" %s+0x%lx\n", sym->name, sym->offset);
}
}
}
Expand Down
Loading
Loading