[lldb-dev] Suspicious flag clash in SymbolContextItem enumeration

Martin Filteau via lldb-dev lldb-dev at lists.llvm.org
Thu Jun 2 11:56:17 PDT 2016


Hi all,

I was investigating a bug when I saw something suspicious in: 

StackFrame.cpp:38

// The first bits in the flags are reserved for the SymbolContext::Scope bits
// so we know if we have tried to look up information in our internal symbol
// context (m_sc) already.
#define RESOLVED_FRAME_CODE_ADDR        (uint32_t(eSymbolContextEverything + 1))
#define RESOLVED_FRAME_ID_SYMBOL_SCOPE  (RESOLVED_FRAME_CODE_ADDR << 1)
#define GOT_FRAME_BASE                  (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1)
#define RESOLVED_VARIABLES              (GOT_FRAME_BASE << 1)
#define RESOLVED_GLOBAL_VARIABLES       (RESOLVED_VARIABLES << 1)

lldb-enumerations.h:310
    FLAGS_ENUM(SymbolContextItem)
    {
        eSymbolContextTarget     = (1u << 0), ///< Set when \a target is requested from a query, or was located in query results
        eSymbolContextModule     = (1u << 1), ///< Set when \a module is requested from a query, or was located in query results
        eSymbolContextCompUnit   = (1u << 2), ///< Set when \a comp_unit is requested from a query, or was located in query results
        eSymbolContextFunction   = (1u << 3), ///< Set when \a function is requested from a query, or was located in query results
        eSymbolContextBlock      = (1u << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
        eSymbolContextLineEntry  = (1u << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
        eSymbolContextSymbol     = (1u << 6), ///< Set when \a symbol is requested from a query, or was located in query results
        eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u),  ///< Indicates to try and lookup everything up during a routine symbol context query.
        eSymbolContextVariable   = (1u << 7)  ///< Set when \a global or static variable is requested from a query, or was located in query results.
                                              ///< eSymbolContextVariable is potentially expensive to lookup so it isn't included in
                                              ///< eSymbolContextEverything which stops it from being used during frame PC lookups and
                                              ///< many other potential address to symbol context lookups.
    };

So, both RESOLVED_FRAME_CODE_ADDR and eSymbolContextVariable have the same value (0x80).

-Martin


More information about the lldb-dev mailing list