Skip to content

How to pretty print concurrent queue contents in GDB? #436

Description

@372046933

For example. I have a field moodycamel::ConcurrentQueue<std::string> first_n_logs_;
print in gdb shows the following.

p (*(*(('absl::lts_20230802::container_internal::map_slot_type<int, tt::PerLearnerFirstN<200>*>'*)(tt::PerLearnerFirstN<200>::instances_.settings_ .value.slots_) + 9)).value.second).first_n_logs_ 

$13 = {static BLOCK_SIZE = 32, static EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD = 32, static EXPLICIT_INITIAL_INDEX_SIZE = 32, static IMPLICIT_INITIAL_INDEX_SIZE = 32, 
  static INITIAL_IMPLICIT_PRODUCER_HASH_SIZE = 32, static EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE = 256, static MAX_SUBQUEUE_SIZE = 18446744073709551615, 
  producerListTail = std::atomic<moodycamel::ConcurrentQueue<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, moodycamel::ConcurrentQueueDefaultTraits>::ProducerBase *> = { 0x55615a61e310 }, producerCount = std::atomic<unsigned int> = { 56 }, initialBlockPoolIndex = std::atomic<unsigned long> = { 32 }, 
  initialBlockPool = 0x556189862000, initialBlockPoolSize = 32, freeList = {
    freeListHead = std::atomic<moodycamel::ConcurrentQueue<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, moodycamel::ConcurrentQueueDefaultTraits>::Block *> = { 0x0 }, static REFS_MASK = 2147483647, static SHOULD_BE_ON_FREELIST = 2147483648}, 
  implicitProducerHash = std::atomic<moodycamel::ConcurrentQueue<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, moodycamel::ConcurrentQueueDefaultTraits>::ImplicitProducerHash *> = { 0x556158937600 }, implicitProducerHashCount = std::atomic<unsigned long> = { 56 }, initialImplicitProducerHash = {
    capacity = 32, entries = 0x5568e37771e0, prev = 0x0}, initialImplicitProducerHashEntries = {_M_elems = {{key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {
        key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 93876558397624 }, value = 0x556158758460}, {
        key = std::atomic<unsigned long> = { 93876536967352 }, value = 0x556158758f50}, {key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {
        key = std::atomic<unsigned long> = { 93876536230072 }, value = 0x556150d7bf10}, {key = std::atomic<unsigned long> = { 93876549550264 }, value = 0x5568e45a19d0}, {
        key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 93876513120440 }, value = 0x5568e45a0a10}, {
        key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 0 }, 
        value = 0x0}, {key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 93877475827896 }, value = 0x5576988ed110}, {
        key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 93876562460856 }, value = 0x5568e45a13b0}, {
        key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 93876483055800 }, value = 0x5568e3b4e620}, {
        key = std::atomic<unsigned long> = { 93876547485880 }, value = 0x5568e3b4f880}, {key = std::atomic<unsigned long> = { 93876535673016 }, value = 0x5568e3b4f960}, {
        key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {
        key = std::atomic<unsigned long> = { 93876512473272 }, value = 0x556150d7bce0}, {key = std::atomic<unsigned long> = { 93876497793208 }, value = 0x5568e45a1420}, {
        key = std::atomic<unsigned long> = { 93876517183672 }, value = 0x5568e45a0e70}, {key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {
        key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 0 }, 
        value = 0x0}, {key = std::atomic<unsigned long> = { 0 }, value = 0x0}, {key = std::atomic<unsigned long> = { 93876504813752 }, value = 0x55615a5cbc70}, {
        key = std::atomic<unsigned long> = { 93876519927992 }, value = 0x55618925a1c0}}}, implicitProducerHashResizeInProgress = {<__atomic_flag_base> = {
      _M_i = false}, <No data fields>}, nextExplicitConsumerId = std::atomic<unsigned int> = { 0 }, globalExplicitConsumerOffset = std::atomic<unsigned int> = { 0 }}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions