aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile40
-rw-r--r--tools/perf/arch/sparc/Makefile4
-rw-r--r--tools/perf/arch/sparc/util/dwarf-regs.c43
-rw-r--r--tools/perf/builtin-report.c2
-rwxr-xr-xtools/perf/util/PERF-VERSION-GEN17
-rw-r--r--tools/perf/util/callchain.c35
-rw-r--r--tools/perf/util/callchain.h5
-rw-r--r--tools/perf/util/hist.c29
-rw-r--r--tools/perf/util/symbol.c17
9 files changed, 132 insertions, 60 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3d8f31ed771d..d75c28a825f5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -600,30 +600,32 @@ endif
600 600
601ifdef NO_DEMANGLE 601ifdef NO_DEMANGLE
602 BASIC_CFLAGS += -DNO_DEMANGLE 602 BASIC_CFLAGS += -DNO_DEMANGLE
603else ifdef HAVE_CPLUS_DEMANGLE
604 EXTLIBS += -liberty
605 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
606else 603else
607 has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") 604 ifdef HAVE_CPLUS_DEMANGLE
608 605 EXTLIBS += -liberty
609 ifeq ($(has_bfd),y) 606 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
610 EXTLIBS += -lbfd
611 else 607 else
612 has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") 608 has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
613 ifeq ($(has_bfd_iberty),y) 609
614 EXTLIBS += -lbfd -liberty 610 ifeq ($(has_bfd),y)
611 EXTLIBS += -lbfd
615 else 612 else
616 has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") 613 has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
617 ifeq ($(has_bfd_iberty_z),y) 614 ifeq ($(has_bfd_iberty),y)
618 EXTLIBS += -lbfd -liberty -lz 615 EXTLIBS += -lbfd -liberty
619 else 616 else
620 has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") 617 has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
621 ifeq ($(has_cplus_demangle),y) 618 ifeq ($(has_bfd_iberty_z),y)
622 EXTLIBS += -liberty 619 EXTLIBS += -lbfd -liberty -lz
623 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
624 else 620 else
625 msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) 621 has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
626 BASIC_CFLAGS += -DNO_DEMANGLE 622 ifeq ($(has_cplus_demangle),y)
623 EXTLIBS += -liberty
624 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
625 else
626 msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
627 BASIC_CFLAGS += -DNO_DEMANGLE
628 endif
627 endif 629 endif
628 endif 630 endif
629 endif 631 endif
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
new file mode 100644
index 000000000000..15130b50dfe3
--- /dev/null
+++ b/tools/perf/arch/sparc/Makefile
@@ -0,0 +1,4 @@
1ifndef NO_DWARF
2PERF_HAVE_DWARF_REGS := 1
3LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
4endif
diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c b/tools/perf/arch/sparc/util/dwarf-regs.c
new file mode 100644
index 000000000000..0ab88483720c
--- /dev/null
+++ b/tools/perf/arch/sparc/util/dwarf-regs.c
@@ -0,0 +1,43 @@
1/*
2 * Mapping of DWARF debug register numbers into register names.
3 *
4 * Copyright (C) 2010 David S. Miller <davem@davemloft.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <libio.h>
13#include <dwarf-regs.h>
14
15#define SPARC_MAX_REGS 96
16
17const char *sparc_regs_table[SPARC_MAX_REGS] = {
18 "%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7",
19 "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7",
20 "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7",
21 "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7",
22 "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
23 "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15",
24 "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23",
25 "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31",
26 "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39",
27 "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47",
28 "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55",
29 "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63",
30};
31
32/**
33 * get_arch_regstr() - lookup register name from it's DWARF register number
34 * @n: the DWARF register number
35 *
36 * get_arch_regstr() returns the name of the register in struct
37 * regdwarfnum_table from it's DWARF register number. If the register is not
38 * found in the table, this returns NULL;
39 */
40const char *get_arch_regstr(unsigned int n)
41{
42 return (n <= SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
43}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 359205782964..fd7407c7205c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -107,7 +107,7 @@ static int perf_session__add_hist_entry(struct perf_session *self,
107 goto out_free_syms; 107 goto out_free_syms;
108 err = 0; 108 err = 0;
109 if (symbol_conf.use_callchain) { 109 if (symbol_conf.use_callchain) {
110 err = append_chain(he->callchain, data->callchain, syms); 110 err = append_chain(he->callchain, data->callchain, syms, data->period);
111 if (err) 111 if (err)
112 goto out_free_syms; 112 goto out_free_syms;
113 } 113 }
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 49ece7921914..97d76562a1a0 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -5,17 +5,13 @@ if [ $# -eq 1 ] ; then
5fi 5fi
6 6
7GVF=${OUTPUT}PERF-VERSION-FILE 7GVF=${OUTPUT}PERF-VERSION-FILE
8DEF_VER=v0.0.2.PERF
9 8
10LF=' 9LF='
11' 10'
12 11
13# First see if there is a version file (included in release tarballs), 12# First check if there is a .git to get the version from git describe
14# then try git-describe, then default. 13# otherwise try to get the version from the kernel makefile
15if test -f version 14if test -d ../../.git -o -f ../../.git &&
16then
17 VN=$(cat version) || VN="$DEF_VER"
18elif test -d .git -o -f .git &&
19 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && 15 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
20 case "$VN" in 16 case "$VN" in
21 *$LF*) (exit 1) ;; 17 *$LF*) (exit 1) ;;
@@ -27,7 +23,12 @@ elif test -d .git -o -f .git &&
27then 23then
28 VN=$(echo "$VN" | sed -e 's/-/./g'); 24 VN=$(echo "$VN" | sed -e 's/-/./g');
29else 25else
30 VN="$DEF_VER" 26 eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
27 eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
28 eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
29 eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
30
31 VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"
31fi 32fi
32 33
33VN=$(expr "$VN" : v*'\(.*\)') 34VN=$(expr "$VN" : v*'\(.*\)')
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 62b69ad4aa73..52c777e451ed 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -230,7 +230,7 @@ fill_node(struct callchain_node *node, struct resolved_chain *chain, int start)
230 230
231static void 231static void
232add_child(struct callchain_node *parent, struct resolved_chain *chain, 232add_child(struct callchain_node *parent, struct resolved_chain *chain,
233 int start) 233 int start, u64 period)
234{ 234{
235 struct callchain_node *new; 235 struct callchain_node *new;
236 236
@@ -238,7 +238,7 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
238 fill_node(new, chain, start); 238 fill_node(new, chain, start);
239 239
240 new->children_hit = 0; 240 new->children_hit = 0;
241 new->hit = 1; 241 new->hit = period;
242} 242}
243 243
244/* 244/*
@@ -248,7 +248,8 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
248 */ 248 */
249static void 249static void
250split_add_child(struct callchain_node *parent, struct resolved_chain *chain, 250split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
251 struct callchain_list *to_split, int idx_parents, int idx_local) 251 struct callchain_list *to_split, int idx_parents, int idx_local,
252 u64 period)
252{ 253{
253 struct callchain_node *new; 254 struct callchain_node *new;
254 struct list_head *old_tail; 255 struct list_head *old_tail;
@@ -275,41 +276,41 @@ split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
275 /* create a new child for the new branch if any */ 276 /* create a new child for the new branch if any */
276 if (idx_total < chain->nr) { 277 if (idx_total < chain->nr) {
277 parent->hit = 0; 278 parent->hit = 0;
278 add_child(parent, chain, idx_total); 279 add_child(parent, chain, idx_total, period);
279 parent->children_hit++; 280 parent->children_hit += period;
280 } else { 281 } else {
281 parent->hit = 1; 282 parent->hit = period;
282 } 283 }
283} 284}
284 285
285static int 286static int
286__append_chain(struct callchain_node *root, struct resolved_chain *chain, 287__append_chain(struct callchain_node *root, struct resolved_chain *chain,
287 unsigned int start); 288 unsigned int start, u64 period);
288 289
289static void 290static void
290__append_chain_children(struct callchain_node *root, 291__append_chain_children(struct callchain_node *root,
291 struct resolved_chain *chain, 292 struct resolved_chain *chain,
292 unsigned int start) 293 unsigned int start, u64 period)
293{ 294{
294 struct callchain_node *rnode; 295 struct callchain_node *rnode;
295 296
296 /* lookup in childrens */ 297 /* lookup in childrens */
297 chain_for_each_child(rnode, root) { 298 chain_for_each_child(rnode, root) {
298 unsigned int ret = __append_chain(rnode, chain, start); 299 unsigned int ret = __append_chain(rnode, chain, start, period);
299 300
300 if (!ret) 301 if (!ret)
301 goto inc_children_hit; 302 goto inc_children_hit;
302 } 303 }
303 /* nothing in children, add to the current node */ 304 /* nothing in children, add to the current node */
304 add_child(root, chain, start); 305 add_child(root, chain, start, period);
305 306
306inc_children_hit: 307inc_children_hit:
307 root->children_hit++; 308 root->children_hit += period;
308} 309}
309 310
310static int 311static int
311__append_chain(struct callchain_node *root, struct resolved_chain *chain, 312__append_chain(struct callchain_node *root, struct resolved_chain *chain,
312 unsigned int start) 313 unsigned int start, u64 period)
313{ 314{
314 struct callchain_list *cnode; 315 struct callchain_list *cnode;
315 unsigned int i = start; 316 unsigned int i = start;
@@ -345,18 +346,18 @@ __append_chain(struct callchain_node *root, struct resolved_chain *chain,
345 346
346 /* we match only a part of the node. Split it and add the new chain */ 347 /* we match only a part of the node. Split it and add the new chain */
347 if (i - start < root->val_nr) { 348 if (i - start < root->val_nr) {
348 split_add_child(root, chain, cnode, start, i - start); 349 split_add_child(root, chain, cnode, start, i - start, period);
349 return 0; 350 return 0;
350 } 351 }
351 352
352 /* we match 100% of the path, increment the hit */ 353 /* we match 100% of the path, increment the hit */
353 if (i - start == root->val_nr && i == chain->nr) { 354 if (i - start == root->val_nr && i == chain->nr) {
354 root->hit++; 355 root->hit += period;
355 return 0; 356 return 0;
356 } 357 }
357 358
358 /* We match the node and still have a part remaining */ 359 /* We match the node and still have a part remaining */
359 __append_chain_children(root, chain, i); 360 __append_chain_children(root, chain, i, period);
360 361
361 return 0; 362 return 0;
362} 363}
@@ -380,7 +381,7 @@ static void filter_context(struct ip_callchain *old, struct resolved_chain *new,
380 381
381 382
382int append_chain(struct callchain_node *root, struct ip_callchain *chain, 383int append_chain(struct callchain_node *root, struct ip_callchain *chain,
383 struct map_symbol *syms) 384 struct map_symbol *syms, u64 period)
384{ 385{
385 struct resolved_chain *filtered; 386 struct resolved_chain *filtered;
386 387
@@ -397,7 +398,7 @@ int append_chain(struct callchain_node *root, struct ip_callchain *chain,
397 if (!filtered->nr) 398 if (!filtered->nr)
398 goto end; 399 goto end;
399 400
400 __append_chain_children(root, filtered, 0); 401 __append_chain_children(root, filtered, 0, period);
401end: 402end:
402 free(filtered); 403 free(filtered);
403 404
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 1ca73e4a2723..f2e9ee164bd8 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -49,6 +49,9 @@ static inline void callchain_init(struct callchain_node *node)
49 INIT_LIST_HEAD(&node->brothers); 49 INIT_LIST_HEAD(&node->brothers);
50 INIT_LIST_HEAD(&node->children); 50 INIT_LIST_HEAD(&node->children);
51 INIT_LIST_HEAD(&node->val); 51 INIT_LIST_HEAD(&node->val);
52
53 node->parent = NULL;
54 node->hit = 0;
52} 55}
53 56
54static inline u64 cumul_hits(struct callchain_node *node) 57static inline u64 cumul_hits(struct callchain_node *node)
@@ -58,7 +61,7 @@ static inline u64 cumul_hits(struct callchain_node *node)
58 61
59int register_callchain_param(struct callchain_param *param); 62int register_callchain_param(struct callchain_param *param);
60int append_chain(struct callchain_node *root, struct ip_callchain *chain, 63int append_chain(struct callchain_node *root, struct ip_callchain *chain,
61 struct map_symbol *syms); 64 struct map_symbol *syms, u64 period);
62 65
63bool ip_callchain__valid(struct ip_callchain *chain, event_t *event); 66bool ip_callchain__valid(struct ip_callchain *chain, event_t *event);
64#endif /* __PERF_CALLCHAIN_H */ 67#endif /* __PERF_CALLCHAIN_H */
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 07f89b66b318..784ee0bdda77 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -631,9 +631,14 @@ int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
631 u64 session_total) 631 u64 session_total)
632{ 632{
633 char bf[512]; 633 char bf[512];
634 hist_entry__snprintf(self, bf, sizeof(bf), pair_hists, 634 int ret;
635 show_displacement, displacement, 635
636 true, session_total); 636 ret = hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
637 show_displacement, displacement,
638 true, session_total);
639 if (!ret)
640 return 0;
641
637 return fprintf(fp, "%s\n", bf); 642 return fprintf(fp, "%s\n", bf);
638} 643}
639 644
@@ -762,6 +767,7 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
762print_entries: 767print_entries:
763 for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) { 768 for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
764 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); 769 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
770 int cnt;
765 771
766 if (show_displacement) { 772 if (show_displacement) {
767 if (h->pair != NULL) 773 if (h->pair != NULL)
@@ -771,8 +777,13 @@ print_entries:
771 displacement = 0; 777 displacement = 0;
772 ++position; 778 ++position;
773 } 779 }
774 ret += hist_entry__fprintf(h, pair, show_displacement, 780 cnt = hist_entry__fprintf(h, pair, show_displacement,
775 displacement, fp, self->stats.total_period); 781 displacement, fp, self->stats.total_period);
782 /* Ignore those that didn't match the parent filter */
783 if (!cnt)
784 continue;
785
786 ret += cnt;
776 787
777 if (symbol_conf.use_callchain) 788 if (symbol_conf.use_callchain)
778 ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period); 789 ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period);
@@ -965,13 +976,17 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
965 * Parse hexa addresses followed by ':' 976 * Parse hexa addresses followed by ':'
966 */ 977 */
967 line_ip = strtoull(tmp, &tmp2, 16); 978 line_ip = strtoull(tmp, &tmp2, 16);
968 if (*tmp2 != ':' || tmp == tmp2) 979 if (*tmp2 != ':' || tmp == tmp2 || tmp2[1] == '\0')
969 line_ip = -1; 980 line_ip = -1;
970 } 981 }
971 982
972 if (line_ip != -1) { 983 if (line_ip != -1) {
973 u64 start = map__rip_2objdump(self->ms.map, sym->start); 984 u64 start = map__rip_2objdump(self->ms.map, sym->start),
985 end = map__rip_2objdump(self->ms.map, sym->end);
986
974 offset = line_ip - start; 987 offset = line_ip - start;
988 if (offset < 0 || (u64)line_ip > end)
989 offset = -1;
975 } 990 }
976 991
977 objdump_line = objdump_line__new(offset, line); 992 objdump_line = objdump_line__new(offset, line);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b63e5713849f..5b276833e2bf 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1443,6 +1443,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1443{ 1443{
1444 struct dirent *dent; 1444 struct dirent *dent;
1445 DIR *dir = opendir(dir_name); 1445 DIR *dir = opendir(dir_name);
1446 int ret = 0;
1446 1447
1447 if (!dir) { 1448 if (!dir) {
1448 pr_debug("%s: cannot open %s dir\n", __func__, dir_name); 1449 pr_debug("%s: cannot open %s dir\n", __func__, dir_name);
@@ -1465,8 +1466,9 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1465 1466
1466 snprintf(path, sizeof(path), "%s/%s", 1467 snprintf(path, sizeof(path), "%s/%s",
1467 dir_name, dent->d_name); 1468 dir_name, dent->d_name);
1468 if (map_groups__set_modules_path_dir(self, path) < 0) 1469 ret = map_groups__set_modules_path_dir(self, path);
1469 goto failure; 1470 if (ret < 0)
1471 goto out;
1470 } else { 1472 } else {
1471 char *dot = strrchr(dent->d_name, '.'), 1473 char *dot = strrchr(dent->d_name, '.'),
1472 dso_name[PATH_MAX]; 1474 dso_name[PATH_MAX];
@@ -1487,17 +1489,18 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1487 dir_name, dent->d_name); 1489 dir_name, dent->d_name);
1488 1490
1489 long_name = strdup(path); 1491 long_name = strdup(path);
1490 if (long_name == NULL) 1492 if (long_name == NULL) {
1491 goto failure; 1493 ret = -1;
1494 goto out;
1495 }
1492 dso__set_long_name(map->dso, long_name); 1496 dso__set_long_name(map->dso, long_name);
1493 dso__kernel_module_get_build_id(map->dso, ""); 1497 dso__kernel_module_get_build_id(map->dso, "");
1494 } 1498 }
1495 } 1499 }
1496 1500
1497 return 0; 1501out:
1498failure:
1499 closedir(dir); 1502 closedir(dir);
1500 return -1; 1503 return ret;
1501} 1504}
1502 1505
1503static char *get_kernel_version(const char *root_dir) 1506static char *get_kernel_version(const char *root_dir)