diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2015-07-08 09:38:16 +0200 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2015-07-15 08:40:57 +0200 |
commit | e7b01ce03de85cfbbddb6ed755486db528abf1d1 (patch) | |
tree | befceca0e4eb95a1a8fa297c536e4665105d35a8 /gdb/common | |
parent | 210187848791f50ee7dd8eaae8fc4bd371b3550b (diff) | |
download | gdb-e7b01ce03de85cfbbddb6ed755486db528abf1d1.zip gdb-e7b01ce03de85cfbbddb6ed755486db528abf1d1.tar.gz gdb-e7b01ce03de85cfbbddb6ed755486db528abf1d1.tar.bz2 |
ari, btrace: avoid unsigned long long
Fix the ARI warning about the use of unsigned long long. We can't use
ULONGEST as this is defined unsigned long on 64-bit systems. This will
result in a compile error when storing a pointer to an unsigned long long
structure field (declared in perf_event.h as __u64) in a ULONGEST * variable.
Use size_t to hold the buffer size inside GDB and __u64 when interfacing the
Linux kernel.
gdb/
* nat/linux-btrace.c (perf_event_read): Change the type of DATA_HEAD.
(perf_event_read_all): Change the type of SIZE and DATA_HEAD.
(perf_event_read_bts): Change the type of SIZE and READ.
(linux_enable_bts): Change the type of SIZE, PAGES, DATA_SIZE,
and DATA_OFFSET. Move DATA_SIZE declaration. Restrict the buffer size
to UINT_MAX. Check for overflows when using DATA_HEAD from the perf
mmap page.
(linux_enable_pt): Change the type of PAGES and SIZE. Restrict the
buffer size to UINT_MAX.
(linux_read_bts): Change the type of BUFFER_SIZE, SIZE, DATA_HEAD, and
DATA_TAIL.
* nat/linux-btrace.h (struct perf_event_buffer)<size, data_head>
<last_head>: Change type.
* common/btrace-common.h (struct btrace_dat_pt) <size>: Change type.
* common/btrace-common.c (btrace_data_append): Change the type of
SIZE.
* btrace.c (parse_xml_raw): Change the type of SIZE. Change oddness
check.
Diffstat (limited to 'gdb/common')
-rw-r--r-- | gdb/common/btrace-common.c | 2 | ||||
-rw-r--r-- | gdb/common/btrace-common.h | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/gdb/common/btrace-common.c b/gdb/common/btrace-common.c index 95193eb..3595636 100644 --- a/gdb/common/btrace-common.c +++ b/gdb/common/btrace-common.c @@ -158,7 +158,7 @@ btrace_data_append (struct btrace_data *dst, case BTRACE_FORMAT_BTS: { gdb_byte *data; - unsigned long size; + size_t size; size = src->variant.pt.size + dst->variant.pt.size; data = xmalloc (size); diff --git a/gdb/common/btrace-common.h b/gdb/common/btrace-common.h index f22efc5..c90a331 100644 --- a/gdb/common/btrace-common.h +++ b/gdb/common/btrace-common.h @@ -96,7 +96,10 @@ struct btrace_cpu struct btrace_config_bts { - /* The size of the branch trace buffer in bytes. */ + /* The size of the branch trace buffer in bytes. + + This is unsigned int and not size_t since it is registered as + control variable for "set record btrace bts buffer-size". */ unsigned int size; }; @@ -104,7 +107,10 @@ struct btrace_config_bts struct btrace_config_pt { - /* The size of the branch trace buffer in bytes. */ + /* The size of the branch trace buffer in bytes. + + This is unsigned int and not size_t since it is registered as + control variable for "set record btrace pt buffer-size". */ unsigned int size; }; @@ -152,7 +158,7 @@ struct btrace_data_pt gdb_byte *data; /* The size of DATA in bytes. */ - unsigned long size; + size_t size; }; /* The branch trace data. */ |