trace-cmd/0001-trace-cmd-Fix-build-with-gcc-10.patch
2021-07-30 14:48:22 +08:00

90 lines
3.0 KiB
Diff

From 0ea3f5c42ffad95ef55c8b269649a1135e5d02f9 Mon Sep 17 00:00:00 2001
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: Fri, 17 Apr 2020 21:39:14 +0100
Subject: [PATCH] trace-cmd: Fix build with gcc-10
The build fails while building with gcc-10 with the error:
multiple definition of `common_type_field'
Rename the field in trace-hist.c and trace-mem.c to satisfy gcc-10.
Link: http://lore.kernel.org/linux-trace-devel/20200417203914.26358-1-sudipm.mukherjee@gmail.com
Bug-Link: https://bugs.debian.org/957879
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
trace-hist.c | 8 ++++----
trace-mem.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/trace-hist.c b/trace-hist.c
index 2a2e780..42cf154 100644
--- a/trace-hist.c
+++ b/trace-hist.c
@@ -41,7 +41,7 @@ static int kernel_stack_type;
static int long_size;
-struct format_field *common_type_field;
+struct format_field *common_type_hist;
struct format_field *common_pid_field;
struct format_field *sched_wakeup_comm_field;
struct format_field *sched_wakeup_new_comm_field;
@@ -582,7 +582,7 @@ process_record(struct pevent *pevent, struct pevent_record *record)
unsigned long long val;
int type;
- pevent_read_number_field(common_type_field, record->data, &val);
+ pevent_read_number_field(common_type_hist, record->data, &val);
type = val;
if (type == function_type)
@@ -970,8 +970,8 @@ static void do_trace_hist(struct tracecmd_input *handle)
long_size = tracecmd_long_size(handle);
- common_type_field = pevent_find_common_field(event, "common_type");
- if (!common_type_field)
+ common_type_hist = pevent_find_common_field(event, "common_type");
+ if (!common_type_hist)
die("Can't find a 'type' field?");
common_pid_field = pevent_find_common_field(event, "common_pid");
diff --git a/trace-mem.c b/trace-mem.c
index a949b15..30f39ef 100644
--- a/trace-mem.c
+++ b/trace-mem.c
@@ -44,7 +44,7 @@ static int kmem_cache_alloc_type;
static int kmem_cache_alloc_node_type;
static int kmem_cache_free_type;
-struct format_field *common_type_field;
+struct format_field *common_type_mem;
struct format_field *kmalloc_callsite_field;
struct format_field *kmalloc_bytes_req_field;
@@ -383,7 +383,7 @@ process_record(struct pevent *pevent, struct pevent_record *record)
unsigned long long val;
int type;
- pevent_read_number_field(common_type_field, record->data, &val);
+ pevent_read_number_field(common_type_mem, record->data, &val);
type = val;
if (type == kmalloc_type)
@@ -504,8 +504,8 @@ static void do_trace_mem(struct tracecmd_input *handle)
ret = pevent_data_type(pevent, record);
event = pevent_data_event_from_type(pevent, ret);
- common_type_field = pevent_find_common_field(event, "common_type");
- if (!common_type_field)
+ common_type_mem = pevent_find_common_field(event, "common_type");
+ if (!common_type_mem)
die("Can't find a 'type' field?");
update_kmalloc(pevent);
--
1.8.3.1