From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH] add debug helpers: show_insn_bb() & show_insn_entry()
Date: Sat, 7 Nov 2020 14:08:07 +0100 [thread overview]
Message-ID: <20201107130807.12893-1-luc.vanoostenryck@gmail.com> (raw)
These 2 helpers are just small wrappers around show_instruction()
and show_entry() but can be called even when the instruction is
removed. They're just handy when debugging.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
linearize.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/linearize.c b/linearize.c
index c1e3455adb67..d0762f5a3a45 100644
--- a/linearize.c
+++ b/linearize.c
@@ -563,6 +563,15 @@ void show_bb(struct basic_block *bb)
printf("\tEND\n");
}
+///
+// show BB of non-removed instruction
+void show_insn_bb(struct instruction *insn)
+{
+ if (!insn || !insn->bb)
+ return;
+ show_bb(insn->bb);
+}
+
static void show_symbol_usage(pseudo_t pseudo)
{
struct pseudo_user *pu;
@@ -610,6 +619,15 @@ void show_entry(struct entrypoint *ep)
printf("\n");
}
+///
+// show the function containing the instruction but only if not already removed.
+void show_insn_entry(struct instruction *insn)
+{
+ if (!insn || !insn->bb || !insn->bb->ep)
+ return;
+ show_entry(insn->bb->ep);
+}
+
static void bind_label(struct symbol *label, struct basic_block *bb, struct position pos)
{
if (label->bb_target)
--
2.29.2
reply other threads:[~2020-11-07 13:08 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=20201107130807.12893-1-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.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 NNTP newsgroup(s).