Examine the symbolized logs (that is, human readable stack traces) of a crashed component.

The tasks include:

  • Update the sample component to crash when it's started.
  • Build and run the sample component, which generates and registers the debug symbols of the component.
  • Verify that the crashed component's logs are in symbolized format.

In VS Code, do the following:

  1. Select the src/hello_world/hello_world.cc file from the OPEN EDITORS view at the top of VS Code.

  2. Above the line return 0;, add the following line:

    abort();
    

    The main() method now should look like below:

    int main() {
      std::cout << "Hello again, World!\n";
      {{ '<strong>' }}abort();{{ '</strong>' }}
      return 0;
    }
    

    This update will cause the component to crash immediately after printing a message.

  3. To save the file, press CTRL+S (or Command+S on macOS).

  4. Click Run > Run Without Debugging.

    Building a component automatically generates and registers its debug symbols in the development environment.

  5. In the debug toolbar at the top of VS Code, click the Stop icon.

  6. In the terminal, restart the ffx daemon:

    Note: Today, this workaround is required for newly registered symbols to be discovered in the environment. This issue is being tracked in Issue 94614{:.external}.

    tools/ffx daemon stop
    

    A new instance of the ffx daemon starts the next time you run a ffx command or view device logs in VS Code.

  7. Click the FUCHSIA LOGS tab on the VS Code panel.

  8. In the Filter logs text box, type moniker:klog and press Enter.

  9. Verify that the sample component's crash stack is symbolized in the kernel logs.

    Symbolized logs{: .screenshot}

    The symbolized logs above show the exact filenames and line numbers (for example, main() src/hello_world/hello_world.cc:9) that might have caused the component to crash.