Bird
0
0

You wrote the following code to get the task list but the output is garbage or empty. What is the most likely cause?

medium📝 Debug Q14 of 15
FreeRTOS - Debugging and Monitoring
You wrote the following code to get the task list but the output is garbage or empty. What is the most likely cause?
char *buffer;
vTaskList(buffer);
printf("%s", buffer);
ABuffer pointer is uninitialized and does not point to valid memory
BvTaskList() requires two arguments, so this call is invalid
CThe buffer size is too large causing overflow
DvTaskList() only works if tasks are suspended
Step-by-Step Solution
Solution:
  1. Step 1: Check buffer initialization

    The buffer pointer is declared but not assigned memory, so it points to an unknown location.
  2. Step 2: Understand vTaskList() usage

    vTaskList() writes to the buffer pointer, so it must point to valid writable memory (like an array).
  3. Final Answer:

    Buffer pointer is uninitialized and does not point to valid memory -> Option A
  4. Quick Check:

    Uninitialized buffer pointer causes invalid output [OK]
Quick Trick: Always allocate buffer memory before passing to vTaskList() [OK]
Common Mistakes:
  • Passing uninitialized pointer instead of array
  • Assuming vTaskList() needs two arguments
  • Thinking tasks must be suspended for vTaskList() to work

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes