This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Add mmap casts in linux-btrace.c
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 23 Oct 2015 23:55:59 -0000
- Subject: [binutils-gdb] Add mmap casts in linux-btrace.c
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a55515eecb1c8edb875e30a411afc55f304e88d9
commit a55515eecb1c8edb875e30a411afc55f304e88d9
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Fri Oct 23 19:48:48 2015 -0400
Add mmap casts in linux-btrace.c
gdb/ChangeLog:
* linux-btrace.c (linux_enable_pt): Add cast to mmap return.
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/nat/linux-btrace.c | 10 ++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4f506e5..a06f568 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-23 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * linux-btrace.c (linux_enable_pt): Add cast to mmap return.
+
2015-10-23 Simon Marchi <simon.marchi@ericsson.com>
* observer.h (observer_${event}_notification_stub): Add cast.
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 3173146..1c3cb40 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -820,8 +820,9 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
goto err;
/* Allocate the configuration page. */
- header = mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
- pt->file, 0);
+ header = ((struct perf_event_mmap_page *)
+ mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+ pt->file, 0));
if (header == MAP_FAILED)
goto err_file;
@@ -862,8 +863,9 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
header->aux_size = data_size;
length = size;
- pt->pt.mem = mmap (NULL, length, PROT_READ, MAP_SHARED, pt->file,
- header->aux_offset);
+ pt->pt.mem = ((const uint8_t *)
+ mmap (NULL, length, PROT_READ, MAP_SHARED, pt->file,
+ header->aux_offset));
if (pt->pt.mem != MAP_FAILED)
break;
}