|
@@ -43,6 +43,10 @@ static int dump_trace = 0;
|
|
|
|
|
|
static int verbose;
|
|
|
|
|
|
+static int modules;
|
|
|
+
|
|
|
+static int full_paths;
|
|
|
+
|
|
|
static int print_line;
|
|
|
|
|
|
static unsigned long page_size;
|
|
@@ -171,7 +175,7 @@ static int load_kernel(void)
|
|
|
if (!kernel_dso)
|
|
|
return -1;
|
|
|
|
|
|
- err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, 0);
|
|
|
+ err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, modules);
|
|
|
if (err <= 0) {
|
|
|
dso__delete(kernel_dso);
|
|
|
kernel_dso = NULL;
|
|
@@ -1268,19 +1272,25 @@ static void print_summary(char *filename)
|
|
|
|
|
|
static void annotate_sym(struct dso *dso, struct symbol *sym)
|
|
|
{
|
|
|
- char *filename = dso->name;
|
|
|
+ char *filename = dso->name, *d_filename;
|
|
|
u64 start, end, len;
|
|
|
char command[PATH_MAX*2];
|
|
|
FILE *file;
|
|
|
|
|
|
if (!filename)
|
|
|
return;
|
|
|
- if (dso == kernel_dso)
|
|
|
+ if (sym->module)
|
|
|
+ filename = sym->module->path;
|
|
|
+ else if (dso == kernel_dso)
|
|
|
filename = vmlinux;
|
|
|
|
|
|
start = sym->obj_start;
|
|
|
if (!start)
|
|
|
start = sym->start;
|
|
|
+ if (full_paths)
|
|
|
+ d_filename = filename;
|
|
|
+ else
|
|
|
+ d_filename = basename(filename);
|
|
|
|
|
|
end = start + sym->end - sym->start + 1;
|
|
|
len = sym->end - sym->start;
|
|
@@ -1291,13 +1301,14 @@ static void annotate_sym(struct dso *dso, struct symbol *sym)
|
|
|
}
|
|
|
|
|
|
printf("\n\n------------------------------------------------\n");
|
|
|
- printf(" Percent | Source code & Disassembly of %s\n", filename);
|
|
|
+ printf(" Percent | Source code & Disassembly of %s\n", d_filename);
|
|
|
printf("------------------------------------------------\n");
|
|
|
|
|
|
if (verbose >= 2)
|
|
|
printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name);
|
|
|
|
|
|
- sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s", (u64)start, (u64)end, filename);
|
|
|
+ sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s|grep -v %s",
|
|
|
+ (u64)start, (u64)end, filename, filename);
|
|
|
|
|
|
if (verbose >= 3)
|
|
|
printf("doing: %s\n", command);
|
|
@@ -1472,8 +1483,12 @@ static const struct option options[] = {
|
|
|
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
|
|
|
"dump raw trace in ASCII"),
|
|
|
OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
|
|
|
+ OPT_BOOLEAN('m', "modules", &modules,
|
|
|
+ "load module symbols - WARNING: use only with -k and LIVE kernel"),
|
|
|
OPT_BOOLEAN('l', "print-line", &print_line,
|
|
|
"print matching source lines (may be slow)"),
|
|
|
+ OPT_BOOLEAN('P', "full-paths", &full_paths,
|
|
|
+ "Don't shorten the displayed pathnames"),
|
|
|
OPT_END()
|
|
|
};
|
|
|
|