ruediger / Boost-Pretty-Printer

GDB Pretty Printers for Boost
197 stars 61 forks source link

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

Open fperies opened 4 years ago

fperies commented 4 years ago

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 !

mbalabin commented 4 years ago

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

mbalabin commented 4 years ago

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

fperies commented 4 years ago

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

mbalabin commented 4 years ago

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 commented 4 years ago

@fperies Is this issue still relevant?