Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 2/3] perf symbols: Old versions of elf.h don't have NT_GNU_BUILD_ID

1 view
Skip to first unread message

Arnaldo Carvalho de Melo

unread,
Nov 21, 2009, 11:31:48 AM11/21/09
to Ingo Molnar, linux-...@vger.kernel.org, Arnaldo Carvalho de Melo, Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra, Paul Mackerras
From: Arnaldo Carvalho de Melo <ac...@redhat.com>

Cc: Frédéric Weisbecker <fwei...@gmail.com>
Cc: Mike Galbraith <efa...@gmx.de>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Paul Mackerras <pau...@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/util/symbol.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e161a51..86ec6c7 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -12,6 +12,10 @@
#include <limits.h>
#include <sys/utsname.h>

+#ifndef NT_GNU_BUILD_ID
+#define NT_GNU_BUILD_ID 3
+#endif
+
enum dso_origin {
DSO__ORIG_KERNEL = 0,
DSO__ORIG_JAVA_JIT,
--
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Arnaldo Carvalho de Melo

unread,
Nov 21, 2009, 11:31:59 AM11/21/09
to Ingo Molnar, linux-...@vger.kernel.org, Arnaldo Carvalho de Melo, Steven Rostedt, Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra, Paul Mackerras
From: Arnaldo Carvalho de Melo <ac...@redhat.com>

It better propagate errors, also if we do a simple:

[root@doppio linux-2.6-tip]# perf record -R -a -f sleep 3s ; perf trace
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.182 MB perf.data (~7972 samples) ]
Fatal: not an trace data file
[root@doppio linux-2.6-tip]#

That is what is expected, right? I.e. as we didn't specify any
tracepoint event via -e, it should gracefully bail out and not SEGFAULT.

Cc: Steven Rostedt <ros...@goodmis.org>


Cc: Frédéric Weisbecker <fwei...@gmail.com>
Cc: Mike Galbraith <efa...@gmx.de>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Paul Mackerras <pau...@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---

tools/perf/util/trace-event-info.c | 22 +++++++++++++++-------
tools/perf/util/trace-event.h | 2 +-
2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 831052d..cace355 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -33,11 +33,11 @@
#include <ctype.h>
#include <errno.h>
#include <stdbool.h>
+#include <linux/kernel.h>

#include "../perf.h"
#include "trace-event.h"

-
#define VERSION "0.5"

#define _STR(x) #x
@@ -483,23 +483,31 @@ static struct tracepoint_path *
get_tracepoints_path(struct perf_event_attr *pattrs, int nb_events)
{
struct tracepoint_path path, *ppath = &path;
- int i;
+ int i, nr_tracepoints = 0;

for (i = 0; i < nb_events; i++) {
if (pattrs[i].type != PERF_TYPE_TRACEPOINT)
continue;
+ ++nr_tracepoints;
ppath->next = tracepoint_id_to_path(pattrs[i].config);
if (!ppath->next)
die("%s\n", "No memory to alloc tracepoints list");
ppath = ppath->next;
}

- return path.next;
+ return nr_tracepoints > 0 ? path.next : NULL;
}
-void read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events)
+
+int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events)
{
char buf[BUFSIZ];
- struct tracepoint_path *tps;
+ struct tracepoint_path *tps = get_tracepoints_path(pattrs, nb_events);
+
+ /*
+ * What? No tracepoints? No sense writing anything here, bail out.
+ */
+ if (tps == NULL)
+ return -1;

output_fd = fd;

@@ -528,11 +536,11 @@ void read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events)
page_size = getpagesize();
write_or_die(&page_size, 4);

- tps = get_tracepoints_path(pattrs, nb_events);
-
read_header_files();
read_ftrace_files(tps);
read_event_files(tps);
read_proc_kallsyms();
read_ftrace_printk();
+
+ return 0;
}
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index f6637c2..dd51c68 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -248,7 +248,7 @@ unsigned long long
raw_field_value(struct event *event, const char *name, void *data);
void *raw_field_ptr(struct event *event, const char *name, void *data);

-void read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events);
+int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events);

/* taken from kernel/trace/trace.h */
enum trace_flag_type {

Arnaldo Carvalho de Melo

unread,
Nov 21, 2009, 11:35:26 AM11/21/09
to Ingo Molnar, linux-...@vger.kernel.org, Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra, Paul Mackerras
Em Sat, Nov 21, 2009 at 02:31:24PM -0200, Arnaldo Carvalho de Melo escreveu:
> From: Arnaldo Carvalho de Melo <ac...@redhat.com>
>
> We better call this routine after both the kernel and modules are
> loaded, because as it was if there weren't modules it would be called,

s/would/would not/g

Ingo, if you see this before merging, please ammend the above comment
line :)

> resulting in kernel_map->end remaining at zero, so no map would be found
> and consequently the kernel symtab wouldn't get loaded, i.e. no kernel
> symbols would be resolved.
>
> Also this fixes another case, that is when we _have_ modules, but the
> last map would have its ->end address not set before we loaded its
> symbols, which would never happen because ->end was not set.

0 new messages