cameron314 / cameron314/concurrentqueue

How to pretty print concurrent queue contents in GDB?

Open
#436 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
12.5k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

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 }}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file, test, or entry point is mentioned. Start by reviewing the queue's C++ data structures and GDB's support for inspecting them; done would be a documented, reproducible way to display the queue contents clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.