[PATCH 2/2] use show_pseudo() for OP_SYMADDR's symbol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In show_instruction(), what is done to display OP_SYMADDR's
symbol is very close to what is done to display a PSEUDO_SYM.
In fact, what is done by show_pseudo() is more complete and
more informative.

So simply use show_pseudo() to display this part. This will
also avoid crashes caused by a NULL symbol.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 linearize.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/linearize.c b/linearize.c
index c174d631f..4995d06ec 100644
--- a/linearize.c
+++ b/linearize.c
@@ -342,24 +342,11 @@ const char *show_instruction(struct instruction *insn)
 		buf += sprintf(buf, ".L%u", insn->bb_true->nr);
 		break;
 
-	case OP_SYMADDR: {
-		struct symbol *sym = insn->symbol->sym;
+	case OP_SYMADDR:
 		buf += sprintf(buf, "%s <- ", show_pseudo(insn->target));
-
-		if (!insn->bb && !sym)
-			break;
-		if (sym->bb_target) {
-			buf += sprintf(buf, ".L%u", sym->bb_target->nr);
-			break;
-		}
-		if (sym->ident) {
-			buf += sprintf(buf, "%s", show_ident(sym->ident));
-			break;
-		}
-		buf += sprintf(buf, "<anon symbol:%p>", verbose ? sym : NULL);
+		buf += sprintf(buf, "%s", show_pseudo(insn->symbol));
 		break;
-	}
-		
+
 	case OP_SETVAL: {
 		struct expression *expr = insn->val;
 		struct symbol *sym;
-- 
2.16.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux