Git Product home page Git Product logo

asio-debugger-extensions's Introduction

asio-debugger-extensions

GDB and LLDB debugger extensions for use with Asio and Boost.Asio.

Pretty Printing

Pretty printing is supported for the following asio:: and boost::asio:: types when using GDB:

  • execution::any_executor<...>
  • any_completion_executor
  • any_io_executor
  • io_context::executor_type and related executor types

Awaitable Backtrace

The abt command may be used to produce a backtrace or call stack for coroutines that use the asio::awaitable or boost::asio::awaitable templates for their return types.

For example, given the program:

#include <asio.hpp>
#include <chrono>
#include <iostream>

asio::awaitable<void> inner()
{
  asio::steady_timer timer(co_await asio::this_coro::executor);
  for (int i = 0; i < 10; ++i)
  {
    timer.expires_after(std::chrono::seconds(1));
    co_await timer.async_wait(asio::use_awaitable);
    std::cout << i << "\n"; // SET BREAKPOINT HERE
  }
}

asio::awaitable<void> middle()
{
  co_return co_await inner();
}

asio::awaitable<void> outer()
{
  for (int i = 0; i < 10; ++i)
    co_await middle();
}

int main()
{
  asio::io_context ctx;
  co_spawn(ctx, outer(), asio::detached);
  ctx.run();
}

running the abt command when stopped at the breakpoint will produce output similar to the following:

(lldb) abt
frame #0 0x0000000100021ea0 inner() at example.cpp:6
frame #1 0x0000000100023510 middle() at example.cpp:17
frame #2 0x0000000100024150 outer() at example.cpp:22
frame #3 0x0000000100025a90 asio::awaitable<void, asio::any_io_executor>
  asio::detail::co_spawn_entry_point<asio::any_io_executor,
  asio::detail::awaitable_as_function<void, asio::any_io_executor>,
  asio::detail::detached_handler>(asio::awaitable<void, asio::any_io_executor>*,
  asio::any_io_executor, asio::detail::awaitable_as_function<void,
  asio::any_io_executor>, asio::detail::detached_handler) at co_spawn.hpp:119

asio-debugger-extensions's People

Contributors

chriskohlhoff avatar pkngpkng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

asio-debugger-extensions's Issues

abt error in clion bundled lldb

address = coro_data.deref.GetValueAsAddress()

error log

(lldb) abt
Traceback (most recent call last):
  File "/Users/xxx/.lldb/scripts/awaitable_backtrace.py", line 44, in awaitable_backtrace
    walk_awaitable_frames(target, awaitable_frame)
  File "/Users/xxx/.lldb/scripts/awaitable_backtrace.py", line 35, in walk_awaitable_frames
    print_coro(target, frame.GetChildMemberWithName("coro_"), depth)
  File "/Users/xxx/.lldb/scripts/awaitable_backtrace.py", line 26, in print_coro
    address = coro_data.deref.GetValueAsAddress()
AttributeError: 'SBValue' object has no attribute 'GetValueAsAddress'

fix it

fix it with: address = int(coro_data.deref.GetValue(), base=16)

documents

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.