Get "num" as unsigned in ctf
authorYao Qi <yao.qi@linaro.org>
Fri, 22 Jul 2016 15:31:41 +0000 (16:31 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 22 Jul 2016 15:31:41 +0000 (16:31 +0100)
I see the following fail due to the warning,

-trace-frame-collected^M
[warning] Extracting signed value from an unsigned int (num)^M
....
FAIL: gdb.trace/mi-trace-frame-collected.exp: ctf: -trace-frame-collected

In ctf metadata, "num" in "tsv" is defined as unint32_t,

  ctf_save_write_metadata (&writer->tcs,
   "event {\n\tname = \"tsv\";\n\tid = %u;\n"
   "\tfields := struct { \n"
   "\t\tuint64_t val;\n"
   "\t\tuint32_t num;\n"
   "\t};\n"
   "};\n", CTF_EVENT_ID_TSV);

so we should read it as unsigned.  The patch below fixes the fail by
changing to bt_ctf_get_uint64.

gdb:

2016-07-22  Yao Qi  <yao.qi@linaro.org>

* ctf.c (ctf_traceframe_info): Call bt_ctf_get_uint64 rather than
bt_ctf_get_int64.

gdb/ChangeLog
gdb/ctf.c

index 4a585355cf334e53f703c9075d5078bfddd6e085..f088912a2283050e82a04a1841c27778c4b42769 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-22  Yao Qi  <yao.qi@linaro.org>
+
+       * ctf.c (ctf_traceframe_info): Call bt_ctf_get_uint64 rather than
+       bt_ctf_get_int64.
+
 2016-07-21  Tom Tromey  <tom@tromey.com>
 
        * rust-lang.c (rust_tuple_struct_type_p): Return false for empty
index 795c365ab3a636b294e3b5b06cd0360aaf22b469..0e13cc1374b1d0679c94679c944b4538033256b1 100644 (file)
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1692,7 +1692,7 @@ ctf_traceframe_info (struct target_ops *self)
          const struct bt_definition *def;
 
          def = bt_ctf_get_field (event, scope, "num");
-         vnum = (int) bt_ctf_get_int64 (def);
+         vnum = (int) bt_ctf_get_uint64 (def);
          VEC_safe_push (int, info->tvars, vnum);
        }
       else