summaryrefslogtreecommitdiff
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <sverker@erlang.org>2022-03-04 20:05:34 +0100
committerSverker Eriksson <sverker@erlang.org>2022-04-07 19:12:03 +0200
commit8ce09b330d018786fd9085ec209afc1f6351b5f4 (patch)
tree3a2913bc3f6d60d2ef93700b6a2f6fc3ca296083 /erts/emulator
parent84ec961084952b8dd423d2b6cdc88e0f360935a8 (diff)
downloaderlang-8ce09b330d018786fd9085ec209afc1f6351b5f4.tar.gz
erts: Fix EventStateFlag printing ERTS_EV_FLAG_WANT_ERROR
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/sys/common/erl_check_io.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/erts/emulator/sys/common/erl_check_io.c b/erts/emulator/sys/common/erl_check_io.c
index 3022ff1598..bf18502887 100644
--- a/erts/emulator/sys/common/erl_check_io.c
+++ b/erts/emulator/sys/common/erl_check_io.c
@@ -93,7 +93,7 @@ typedef enum {
#endif
ERTS_EV_FLAG_WANT_ERROR = 0x10, /* ERL_NIF_SELECT_ERROR turned on */
- /* Combinations */
+ /* Combinations, defined only to be displayed by debugger (gdb) */
ERTS_EV_FLAG_USED_FALLBACK = ERTS_EV_FLAG_USED | ERTS_EV_FLAG_FALLBACK,
ERTS_EV_FLAG_USED_SCHEDULER = ERTS_EV_FLAG_USED | ERTS_EV_FLAG_SCHEDULER,
ERTS_EV_FLAG_USED_IN_SCHEDULER = ERTS_EV_FLAG_USED | ERTS_EV_FLAG_SCHEDULER | ERTS_EV_FLAG_IN_SCHEDULER,
@@ -101,16 +101,25 @@ typedef enum {
ERTS_EV_FLAG_UNUSED_IN_SCHEDULER = ERTS_EV_FLAG_SCHEDULER | ERTS_EV_FLAG_IN_SCHEDULER
} EventStateFlags;
-#define flag2str(flags) \
- ((flags) == ERTS_EV_FLAG_CLEAR ? "CLEAR" : \
- ((flags) == ERTS_EV_FLAG_USED ? "USED" : \
- ((flags) == ERTS_EV_FLAG_FALLBACK ? "FLBK" : \
- ((flags) == ERTS_EV_FLAG_USED_FALLBACK ? "USED|FLBK" : \
- ((flags) == ERTS_EV_FLAG_USED_SCHEDULER ? "USED|SCHD" : \
- ((flags) == ERTS_EV_FLAG_UNUSED_SCHEDULER ? "SCHD" : \
- ((flags) == ERTS_EV_FLAG_USED_IN_SCHEDULER ? "USED|IN_SCHD" : \
- ((flags) == ERTS_EV_FLAG_UNUSED_IN_SCHEDULER ? "IN_SCHD" : \
- "ERROR"))))))))
+
+static const char* event_state_flag_to_str(EventStateFlags f)
+{
+ switch ((int)f) {
+ case ERTS_EV_FLAG_CLEAR: return "CLEAR";
+ case ERTS_EV_FLAG_USED: return "USED";
+ case ERTS_EV_FLAG_FALLBACK: return "FLBK";
+ case ERTS_EV_FLAG_FALLBACK | ERTS_EV_FLAG_USED: return "USED|FLBK";
+
+#if ERTS_POLL_USE_SCHEDULER_POLLING
+ case ERTS_EV_FLAG_SCHEDULER: return "SCHD";
+ case ERTS_EV_FLAG_SCHEDULER | ERTS_EV_FLAG_USED: return "USED|SCHD";
+ case ERTS_EV_FLAG_SCHEDULER | ERTS_EV_FLAG_IN_SCHEDULER: return "IN_SCHD";
+ case ERTS_EV_FLAG_SCHEDULER | ERTS_EV_FLAG_IN_SCHEDULER
+ | ERTS_EV_FLAG_USED: return "USED|IN_SCHD";
+#endif
+ default: return "ERROR";
+ }
+}
/* How many events that can be handled at once by one erts_poll_wait call */
#define ERTS_CHECK_IO_POLL_RES_LEN 512
@@ -2534,7 +2543,11 @@ print_events(erts_dsprintf_buf_t *dsbufp, ErtsPollEvents ev)
static ERTS_INLINE void
print_flags(erts_dsprintf_buf_t *dsbufp, EventStateFlags f)
{
- erts_dsprintf(dsbufp, "%s", flag2str(f));
+ if (f & ERTS_EV_FLAG_WANT_ERROR) {
+ erts_dsprintf(dsbufp, "WANTERR|");
+ f &= ~ERTS_EV_FLAG_WANT_ERROR;
+ }
+ erts_dsprintf(dsbufp, "%s", event_state_flag_to_str(f));
}
#ifdef DEBUG_PRINT_MODE