From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH 2/4] analyzer: better logging for dedupe_winners::add
Date: Tue, 17 Dec 2019 23:01:00 -0000 [thread overview]
Message-ID: <20191217230137.31567-3-dmalcolm@redhat.com> (raw)
In-Reply-To: <20191217230137.31567-1-dmalcolm@redhat.com>
gcc/analyzer/ChangeLog:
* diagnostic-manager.cc (dedupe_winners::add): Add logging
of deduplication decisions made.
---
gcc/analyzer/diagnostic-manager.cc | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index b8aae115ae67..47d32f4f4c6c 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -299,12 +299,19 @@ public:
dedupe_key *key = new dedupe_key (sd, dc->get_path ());
if (dedupe_candidate **slot = m_map.get (key))
{
+ if (logger)
+ logger->log ("already have this dedupe_key");
+
(*slot)->add_duplicate ();
if (dc->length () < (*slot)->length ())
{
/* We've got a shorter path for the key; replace
the current candidate. */
+ if (logger)
+ logger->log ("length %i is better than existing length %i;"
+ " taking over this dedupe_key",
+ dc->length (), (*slot)->length ());
dc->m_num_dupes = (*slot)->get_num_dupes ();
delete *slot;
*slot = dc;
@@ -312,12 +319,22 @@ public:
else
/* We haven't beaten the current best candidate;
drop the new candidate. */
- delete dc;
+ {
+ if (logger)
+ logger->log ("length %i isn't better than existing length %i;"
+ " dropping this candidate",
+ dc->length (), (*slot)->length ());
+ delete dc;
+ }
delete key;
}
else
- /* This is the first candidate for this key. */
- m_map.put (key, dc);
+ {
+ /* This is the first candidate for this key. */
+ m_map.put (key, dc);
+ if (logger)
+ logger->log ("first candidate for this dedupe_key");
+ }
}
/* Emit the simplest diagnostic within each set. */
--
2.21.0
next prev parent reply other threads:[~2019-12-17 23:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 23:01 [PATCH 0/4] analyzer: Fixes for problems seen with CVE-2005-1689 David Malcolm
2019-12-17 23:01 ` [PATCH 1/4] analyzer: add ChangeLog David Malcolm
2019-12-17 23:01 ` [PATCH 3/4] analyzer: fix dedupe issue seen with CVE-2005-1689 David Malcolm
2019-12-17 23:01 ` David Malcolm [this message]
2019-12-17 23:35 ` [PATCH 4/4] analyzer: purge state for unknown function calls David Malcolm
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=20191217230137.31567-3-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.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).