public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH committed] Get "num" as unsigned in ctf
Date: Fri, 22 Jul 2016 15:33:00 -0000	[thread overview]
Message-ID: <1469201599-1177-1-git-send-email-yao.qi@linaro.org> (raw)

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 | 5 +++++
 gdb/ctf.c     | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4a58535..f088912 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 795c365..0e13cc1 100644
--- 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
-- 
1.9.1

                 reply	other threads:[~2016-07-22 15:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469201599-1177-1-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).