File tree Expand file tree Collapse file tree 5 files changed +54
-0
lines changed
source/Plugins/SymbolFile/DWARF Expand file tree Collapse file tree 5 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 30
30
31
31
#include < mutex>
32
32
#include < optional>
33
+ #include < unordered_map>
33
34
34
35
#if defined(LLDB_CONFIGURATION_DEBUG)
35
36
#define ASSERT_MODULE_LOCK (expr ) (expr->AssertModuleLock ())
@@ -435,9 +436,20 @@ class SymbolFile : public PluginInterface {
435
436
436
437
virtual lldb::TypeSP CopyType (const lldb::TypeSP &other_type) = 0;
437
438
439
+ // / Returns a map of compilation unit to the compile option arguments
440
+ // / associated with that compilation unit.
441
+ std::unordered_map<lldb::CompUnitSP, Args> GetCompileOptions () {
442
+ std::unordered_map<lldb::CompUnitSP, Args> args;
443
+ GetCompileOptions (args);
444
+ return args;
445
+ }
446
+
438
447
protected:
439
448
void AssertModuleLock ();
440
449
450
+ virtual void GetCompileOptions (
451
+ std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {}
452
+
441
453
private:
442
454
SymbolFile (const SymbolFile &) = delete ;
443
455
const SymbolFile &operator =(const SymbolFile &) = delete ;
Original file line number Diff line number Diff line change @@ -4255,3 +4255,30 @@ Status SymbolFileDWARF::CalculateFrameVariableError(StackFrame &frame) {
4255
4255
return Status (" no variable information is available in debug info for this "
4256
4256
" compile unit" );
4257
4257
}
4258
+
4259
+ void SymbolFileDWARF::GetCompileOptions (
4260
+ std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {
4261
+
4262
+ const uint32_t num_compile_units = GetNumCompileUnits ();
4263
+
4264
+ for (uint32_t cu_idx = 0 ; cu_idx < num_compile_units; ++cu_idx) {
4265
+ lldb::CompUnitSP comp_unit = GetCompileUnitAtIndex (cu_idx);
4266
+ if (!comp_unit)
4267
+ continue ;
4268
+
4269
+ DWARFUnit *dwarf_cu = GetDWARFCompileUnit (comp_unit.get ());
4270
+ if (!dwarf_cu)
4271
+ continue ;
4272
+
4273
+ const DWARFBaseDIE die = dwarf_cu->GetUnitDIEOnly ();
4274
+ if (!die)
4275
+ continue ;
4276
+
4277
+ const char *flags = die.GetAttributeValueAsString (DW_AT_APPLE_flags, NULL );
4278
+
4279
+ if (!flags)
4280
+ continue ;
4281
+ args.insert ({comp_unit, Args (flags)});
4282
+ }
4283
+ }
4284
+
Original file line number Diff line number Diff line change @@ -523,6 +523,9 @@ class SymbolFileDWARF : public lldb_private::SymbolFileCommon {
523
523
524
524
void InitializeFirstCodeAddress ();
525
525
526
+ void GetCompileOptions (
527
+ std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) override ;
528
+
526
529
lldb::ModuleWP m_debug_map_module_wp;
527
530
SymbolFileDWARFDebugMap *m_debug_map_symfile;
528
531
Original file line number Diff line number Diff line change @@ -1549,3 +1549,12 @@ Status SymbolFileDWARFDebugMap::CalculateFrameVariableError(StackFrame &frame) {
1549
1549
}
1550
1550
return Status ();
1551
1551
}
1552
+
1553
+ void SymbolFileDWARFDebugMap::GetCompileOptions (
1554
+ std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {
1555
+
1556
+ ForEachSymbolFile ([&](SymbolFileDWARF *oso_dwarf) -> bool {
1557
+ oso_dwarf->GetCompileOptions (args);
1558
+ return false ;
1559
+ });
1560
+ }
Original file line number Diff line number Diff line change @@ -153,6 +153,9 @@ class SymbolFileDWARFDebugMap : public lldb_private::SymbolFileCommon {
153
153
// Statistics overrides.
154
154
lldb_private::ModuleList GetDebugInfoModules () override ;
155
155
156
+ void GetCompileOptions (
157
+ std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) override ;
158
+
156
159
protected:
157
160
enum { kHaveInitializedOSOs = (1 << 0 ), kNumFlags };
158
161
You can’t perform that action at this time.
0 commit comments