From a2176c7545c29b28598bb252718cf080a3463665 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 10 Oct 2012 19:24:29 -0700 Subject: [PATCH] action: improve printing The 'value' field of a ModelAction might actually represent a signed number, a pointer, or something else entirely, so values look very huge and uninformative when printed, especially in decimal. Hexadecimal representation makes everything a little more readable, I think. While I'm at it, I adjust the spacing a little and make VALUE_NONE into a different magic number which is more recognizable in hex. --- action.cc | 11 +++++++---- action.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/action.cc b/action.cc index ca128561..44a6d9ad 100644 --- a/action.cc +++ b/action.cc @@ -409,16 +409,19 @@ void ModelAction::print() const break; } - printf("(%3d) Thread: %-2d Action: %-13s MO: %7s Loc: %14p Value: %-12" PRIu64, + printf("(%4d) Thread: %-2d Action: %-13s MO: %7s Loc: %14p Value: %-#18" PRIx64, seq_number, id_to_int(tid), type_str, mo_str, location, valuetoprint); if (is_read()) { if (reads_from) - printf(" Rf: %d", reads_from->get_seq_number()); + printf(" Rf: %-3d", reads_from->get_seq_number()); else - printf(" Rf: ?"); + printf(" Rf: ? "); } if (cv) { - printf("\t"); + if (is_read()) + printf(" "); + else + printf(" "); cv->print(); } else printf("\n"); diff --git a/action.h b/action.h index 4f63c181..dd7de7a1 100644 --- a/action.h +++ b/action.h @@ -26,7 +26,7 @@ using std::memory_order_seq_cst; /** Note that this value can be legitimately used by a program, and hence by iteself does not indicate no value. */ -#define VALUE_NONE 1234567890 +#define VALUE_NONE 0xdeadbeef /** A special value to represent a successful trylock */ -- 2.34.1