Boost-Pretty-Printer icon indicating copy to clipboard operation
Boost-Pretty-Printer copied to clipboard

Python exception during dump of boost::optional (no member named m_initialized)

Open fperies opened this issue 4 years ago • 5 comments

Hello,

First of all, thank you for this project!

I'm running into the following error when trying to dump a boost::optional type object:

(gdb) p 'l2ps::db::UeDbBase<l2ps::ul::db::Ue>::ueDbInstance'
$17 = Python Exception <class 'gdb.error'> There is no member named m_initialized.: 

I'm using Boost 1.69.0

Do you have any clue that would explain this issue ?

Thanks !

fperies avatar May 05 '20 13:05 fperies

Hi, could you please give more details about your case? What is ueDbInstance? Ideally, a minumal test case - it will help greatly.

mbalabin avatar May 08 '20 14:05 mbalabin

Also, what build type (release, debug, etc) and compiler do you use?

mbalabin avatar May 08 '20 14:05 mbalabin

Hello,

ueDbInstance is declared as follows:

template <typename Ue>
class UeDbBase : 
{
   ...
   static boost::optional<l2ps::utils::SharedObject<UeDbBase<Ue>>> ueDbInstance;
   ...
}

SharedObject is basically a class which allocates/deallocates in shared memory (this implementation is plateform specific)

I'm using a debug build with GCC, compilation options are -ggdb3, -O0.

At the stage where I asked to print ueDbInstance, it is supposed to be initialized.

Have you validated the Boost pretty printer when static attribute is set ?

Thanks

fperies avatar May 11 '20 12:05 fperies

Compilation options are pretty standard. I never tried -ggdb3, though, only -ggdb (which is equivalent to -ggdb2). You can try to switch to -ggdb, but it is unlikely that it can fix the problem.

Static members should not be a problem. Is SharedObject a complete type in this translation unit?

Can you print ueDbInstance with printers disabled and post result here? Preferably with set print pretty to make gdb output more readable.

mbalabin avatar May 11 '20 13:05 mbalabin

@fperies Is this issue still relevant?

mbalabin avatar Jul 29 '20 04:07 mbalabin