aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2015-10-27 10:53:24 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2015-10-27 10:54:21 -0400
commite0d13cbd4bcec3e8136925a3a07f85e58187da06 (patch)
tree20f0fd1f63bd5eecd67ebbe625f424bee50d84c3
parent4666280441d1a8d3479d45f1ec5b67cf83d58f35 (diff)
downloadfsf-binutils-gdb-e0d13cbd4bcec3e8136925a3a07f85e58187da06.zip
fsf-binutils-gdb-e0d13cbd4bcec3e8136925a3a07f85e58187da06.tar.gz
fsf-binutils-gdb-e0d13cbd4bcec3e8136925a3a07f85e58187da06.tar.bz2
ctf.c: Fix int/enum implicit cast
This patch was taken directly from Pedro's branch. Right now, SET_INT32_FIELD is used to set enum fields. This works in C, but not C++. Therefore, define the new SET_ENUM_FIELD, which casts the value to the right enum type. gdb/ChangeLog: * ctf.c (SET_ENUM_FIELD): New macro. (ctf_read_status): Use it. (ctf_read_tp): Use it.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/ctf.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index abb4fab..d7554a1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2015-10-27 Simon Marchi <simon.marchi@polymtl.ca>
+ * ctf.c (SET_ENUM_FIELD): New macro.
+ (ctf_read_status): Use it.
+ (ctf_read_tp): Use it.
+
+2015-10-27 Simon Marchi <simon.marchi@polymtl.ca>
+
* guile/scm-breakpoint.c (gdbscm_set_breakpoint_stop_x): Add
scm_t_dynwind_flags casts.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
diff --git a/gdb/ctf.c b/gdb/ctf.c
index dc378d1..b8d7285 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -914,6 +914,12 @@ ctf_open_dir (const char *dirname)
(SCOPE), \
#FIELD))
+#define SET_ENUM_FIELD(EVENT, SCOPE, VAR, TYPE, FIELD) \
+ (VAR)->FIELD = (TYPE) bt_ctf_get_int64 (bt_ctf_get_field ((EVENT), \
+ (SCOPE), \
+ #FIELD))
+
+
/* EVENT is the "status" event and TS is filled in. */
static void
@@ -922,7 +928,7 @@ ctf_read_status (struct bt_ctf_event *event, struct trace_status *ts)
const struct bt_definition *scope
= bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
- SET_INT32_FIELD (event, scope, ts, stop_reason);
+ SET_ENUM_FIELD (event, scope, ts, enum trace_stop_reason, stop_reason);
SET_INT32_FIELD (event, scope, ts, stopping_tracepoint);
SET_INT32_FIELD (event, scope, ts, traceframe_count);
SET_INT32_FIELD (event, scope, ts, traceframes_created);
@@ -1058,7 +1064,7 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
SET_INT32_FIELD (event, scope, utp, step);
SET_INT32_FIELD (event, scope, utp, pass);
SET_INT32_FIELD (event, scope, utp, hit_count);
- SET_INT32_FIELD (event, scope, utp, type);
+ SET_ENUM_FIELD (event, scope, utp, enum bptype, type);
/* Read 'cmd_strings'. */
SET_ARRAY_FIELD (event, scope, utp, cmd_num, cmd_strings);