die.Dump(s, recurse_depth);
}
}
-
-//----------------------------------------------------------------------
-// FindCallbackString
-//
-// A callback function for the static DWARFDebugInfo::Parse() function
-// that gets called each time a compile unit header or debug information
-// entry is successfully parsed.
-//
-// This function will find the die_offset of any items whose DW_AT_name
-// matches the given string
-//----------------------------------------------------------------------
-typedef struct FindCallbackStringInfoTag {
- const char *name;
- bool ignore_case;
- RegularExpression *regex;
- vector<dw_offset_t> &die_offsets;
-} FindCallbackStringInfo;
-
-static dw_offset_t
-FindCallbackString(SymbolFileDWARF *dwarf2Data, DWARFCompileUnit *cu,
- DWARFDebugInfoEntry *die, const dw_offset_t next_offset,
- const uint32_t curr_depth, void *userData) {
- FindCallbackStringInfo *info = (FindCallbackStringInfo *)userData;
-
- if (!die)
- return next_offset;
-
- const char *die_name = die->GetName(dwarf2Data, cu);
- if (!die_name)
- return next_offset;
-
- if (info->regex) {
- if (info->regex->Execute(llvm::StringRef(die_name)))
- info->die_offsets.push_back(die->GetOffset());
- } else {
- if ((info->ignore_case ? strcasecmp(die_name, info->name)
- : strcmp(die_name, info->name)) == 0)
- info->die_offsets.push_back(die->GetOffset());
- }
-
- // Just return the current offset to parse the next CU or DIE entry
- return next_offset;
-}
-
-//----------------------------------------------------------------------
-// Find
-//
-// Finds all DIE that have a specific DW_AT_name attribute by manually
-// searching through the debug information (not using the
-// .debug_pubnames section). The string must match the entire name
-// and case sensitive searches are an option.
-//----------------------------------------------------------------------
-bool DWARFDebugInfo::Find(const char *name, bool ignore_case,
- vector<dw_offset_t> &die_offsets) const {
- die_offsets.clear();
- if (name && name[0]) {
- FindCallbackStringInfo info = {name, ignore_case, NULL, die_offsets};
- DWARFDebugInfo::Parse(m_dwarf2Data, FindCallbackString, &info);
- }
- return !die_offsets.empty();
-}
-
-//----------------------------------------------------------------------
-// Find
-//
-// Finds all DIE that have a specific DW_AT_name attribute by manually
-// searching through the debug information (not using the
-// .debug_pubnames section). The string must match the supplied regular
-// expression.
-//----------------------------------------------------------------------
-bool DWARFDebugInfo::Find(RegularExpression &re,
- vector<dw_offset_t> &die_offsets) const {
- die_offsets.clear();
- FindCallbackStringInfo info = {NULL, false, &re, die_offsets};
- DWARFDebugInfo::Parse(m_dwarf2Data, FindCallbackString, &info);
- return !die_offsets.empty();
-}
static void Verify(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data);
static void Dump(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data,
const uint32_t die_offset, const uint32_t recurse_depth);
- bool Find(const char *name, bool ignore_case,
- std::vector<dw_offset_t> &die_offsets) const;
- bool Find(lldb_private::RegularExpression &re,
- std::vector<dw_offset_t> &die_offsets) const;
enum {
eDumpFlag_Verbose = (1 << 0), // Verbose dumping