aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-10-29 05:54:38 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-11-07 14:06:18 +0100
commit940c785444065041698b7e2d320f52b06ac36f75 (patch)
treec2215cc7960bff8253e7a81d5a916bf3c512ebed
parentf680124b794b246c8a20f2cb54b2fc7ff989625d (diff)
downloadsparse-dev-940c785444065041698b7e2d320f52b06ac36f75.tar.gz
add debug helpers: show_insn_bb() & show_insn_entry()
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>
-rw-r--r--linearize.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/linearize.c b/linearize.c
index c1e3455a..d0762f5a 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)