Why can't gdb see global symbols in all scopes

ori bar tohava@gmail.com
Wed Apr 10 12:26:00 GMT 2019


I am debugging a boost program with full symbols (both the program and
boost lib). In boost there is a variable called
boost::fibers::context_initializer::active_. This can be seen by
running

    (gdb) info variables .*context_init.*
    All variables matching regular expression ".*context_init.*":

    File libs/fiber/src/context.cpp:
    boost::fibers::context *boost::fibers::context_initializer::active_;
    std::size_t boost::fibers::context_initializer::counter_;

I can see it from one thread in my program, but can't see it from
another, even though it's global:

    (gdb) thread 1
    [Switching to thread 1 (Thread 0x7ffff7fcd040 (LWP 10470))]
    #0  0x00007ffff6c089f3 in futex_wait_cancelable
(private=<optimized out>, expected=0, futex_word=0x60c000000234) at
../sysdeps/unix/sysv/linux/futex-internal.h:88
    88  in ../sysdeps/unix/sysv/linux/futex-internal.h
    (gdb) p boost::fibers::context_initializer::active_
    No type "fibers" within class or namespace "boost".
    (gdb) thread 3
    [Switching to thread 3 (Thread 0x7ffff3d28700 (LWP 10475))]
    #0  boost::fibers::context::active () at libs/fiber/src/context.cpp:106
    106     thread_local static context_initializer ctx_initializer;
    (gdb) p boost::fibers::context_initializer::active_
    $1 = (boost::fibers::context *) 0x7ffff1869700

This also happens if I just try "pt
boost::fibers::context_initializer" or try "pt
::boost::fibers::context_initializer".

What can be causing this? Shouldn't global variables and types be
visible from all scopes?


-- 
1110101111111110 - it's a way of life



More information about the Gdb mailing list