public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/gcov-json-add-calls)] Extend the format even more.
@ 2023-04-14 8:16 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2023-04-14 8:16 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a1a7ef4f735621436363df960b1f3c20a1b4da17
commit a1a7ef4f735621436363df960b1f3c20a1b4da17
Author: Martin Liska <mliska@suse.cz>
Date: Thu Apr 13 06:51:29 2023 +0200
Extend the format even more.
Diff:
---
gcc/gcov.cc | 13 +++++++++++++
gcc/testsuite/g++.dg/gcov/test-gcov-17.py | 6 ++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index 88324143640..fa03f32a8e9 100644
--- a/gcc/gcov.cc
+++ b/gcc/gcov.cc
@@ -1113,6 +1113,11 @@ output_intermediate_json_line (json::array *object,
lineo->set ("unexecuted_block",
new json::literal (line->has_unexecuted_block));
+ json::array *bb_ids = new json::array ();
+ for (const block_info *block : line->blocks)
+ bb_ids->append (new json::integer_number (block->id));
+ lineo->set ("block_ids", bb_ids);
+
json::array *branches = new json::array ();
lineo->set ("branches", branches);
@@ -1131,12 +1136,20 @@ output_intermediate_json_line (json::array *object,
branch->set ("throw", new json::literal ((*it)->is_throw));
branch->set ("fallthrough",
new json::literal ((*it)->fall_through));
+ branch->set ("source_block_id",
+ new json::integer_number ((*it)->src->id));
+ branch->set ("destination_block_id",
+ new json::integer_number ((*it)->dst->id));
branches->append (branch);
}
else if ((*it)->is_call_non_return)
{
json::object *call = new json::object ();
gcov_type returns = (*it)->src->count - (*it)->count;
+ call->set ("source_block_id",
+ new json::integer_number ((*it)->src->id));
+ call->set ("destination_block_id",
+ new json::integer_number ((*it)->dst->id));
call->set ("returned", new json::integer_number (returns));
calls->append (call);
}
diff --git a/gcc/testsuite/g++.dg/gcov/test-gcov-17.py b/gcc/testsuite/g++.dg/gcov/test-gcov-17.py
index a0b8b09b85c..0cc6afa9bd9 100644
--- a/gcc/testsuite/g++.dg/gcov/test-gcov-17.py
+++ b/gcc/testsuite/g++.dg/gcov/test-gcov-17.py
@@ -39,8 +39,10 @@ def test_lines(gcov):
line41 = linesdict[41][0]
assert line41['count'] == 1
- assert line41['calls'] == [{'returned': 1}]
+ assert line41['calls'][0]['returned'] == 1
+ assert line41['calls'][0]['source_block_id'] == 13
+ assert line41['calls'][0]['destination_block_id'] == 1
line43 = linesdict[43][0]
assert line43['count'] == 1
- assert line43['calls'] == [{'returned': 0}]
+ assert line43['calls'][0]['returned'] == 0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-14 8:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 8:16 [gcc(refs/users/marxin/heads/gcov-json-add-calls)] Extend the format even more Martin Liska
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).