Given a snippet of embedded code, identify what is wrong with it (bug related to interrupt service routines). Asked in the initial interview stage. This was a 45-min first-round embedded interview, followed by tangential technical questions and OS trivia.
Implement identify_isr_bugs(code). Return issue labels in this order: blocking_call, dynamic_allocation, shared_state_not_volatile, and non_atomic_shared_access. Treat functions containing ISR( or interrupt as handlers. Detect delay, sleep, or wait calls, allocation calls, non-volatile global variables referenced by a handler, and mutations of volatile shared variables.
ISR( or interruptdef identify_isr_bugs(code):