A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://fuchsia.dev/docs/development/debugger/developing below:

Developing and debugging zxdb | Fuchsia

Developing and debugging zxdb

This document covers various topics to help you as you develop and debug the zxdb debugger:

Run tests

To run the zxdb frontend tests:

Note: These tests run on the machine with your current Fuchsia checkout.
fx test zxdb_tests

To run the debug_agent tests:

Note: These tests run on a Fuchsia target device.
fx test debug_agent_unit_tests
fx test debug_agent_integration_tests

To run the end-to-end tests:

Note: These test the integration of the zxdb frontend with the debug_agent.
fx test --e2e zxdb_e2e_tests
Reload debug_agent.cm after a new build

Since the debug_agent_launcher is a long-running process, your system does not try to update the debug_agent package after the first ffx debug connect invocation.

To force the system to unload debug_agent.cm:

ffx component stop /core/debug_agent
Enable debug logging in debug_agent

To enable the debug logging of the debug_agent, add --set-severity core/debug_agent#DEBUG to fx log. For example:

fx log --set-severity core/debug_agent#DEBUG --tag debug_agent --hide_metadata --pretty
Enable debug logging in zxdb

To enable debug logging in zxdb:

ffx debug connect -- --debug-mode
Launch zxdb in another debugger

You can have ffx debug launch zxdb in another debugger such as lldb. For example:

ffx debug connect --debugger lldb

This command brings the lldb shell and you can use run to start zxdb.

Alternatively, instead of lldb you could specify another debugger such as gdb. However, if you use gdb, you may run into some of the following issues:

Debug debug_agent in another debug_agent

You can attach a debug_agent to another debug_agent:

Note: This is a task to help debug issues with zxdb.
  1. Run the debugger that attaches to the "to-be-debugged" debug_agent that you want to debug:

    ffx debug connect
  2. From the zxdb console, run:

    attach debug_agent
    Waiting for process matching "debug_agent".
    Type "filter" to see the current filters.
    Attached Process 1 state=Running koid=345223 name=debug_agent.cm
    Attached Process 2 state=Running koid=345403 name=/pkg/bin/debug_agent
    
  3. The first debug_agent captures the launcher and itself. You can detach the processes to avoid any deadlock.

    For example, to detach process 1:

    [zxdb] pr 1 detach
    

    For example, to detach process 2:

    [zxdb] pr 2 detach
    
  4. Create a breakpoint on the $main function:

    [zxdb] break $main
    
  5. From another terminal, launch another zxdb instance:

    ffx debug connect
  6. In the initial terminal with zxdb, you should see an output like:

    Attached Process 1 state=Running koid=12345 name=/pkg/bin/debug_agent
    Breakpoint 1 now matching 1 addrs for $main
    🛑 process 1 on bp 1 main(int, const char**) • main.cc:101
        99
      100 int main(int argc, const char* argv[]) {
    â–¶ 101   debug_agent::CommandLineOptions options;
      102   cmdline::Status status = ParseCommandLine(argc, argv, &options);
      103   if (status.has_error()) {
    

    You now have two instances of zxdb running.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-02-28 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-28 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4