This is a preparatory step to enable adding extra unwind strategies by
symbol file plugins. This has been discussed on the lldb-dev mailing
list: http://lists.llvm.org/pipermail/lldb-dev/2019-February/014703.html.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
You changed the API to return a pointer which can be NULL so we either need to check all returns for this or change the API to return a reference to a default constructed UnwindTable. I like the latter option, but I will leave that up to you. Since we are moving functionality into symbol files, we might want to opt for the latter to allow us to populate the UnwindTable as needed from any source when ever that source becomes available (like adding a symbol file to a module after the fact).
include/lldb/Core/Module.h | ||
---|---|---|
709 ↗ | (On Diff #186481) | I would vote to return a "UnwindTable&" and make a const and non const version of this. Otherwise we have to NULL check any call to this API. |
1108–1110 ↗ | (On Diff #186481) | Why not just make this an instance to avoid having to null check all accessor calls?: UnwindTable m_unwind_table; |
source/Commands/CommandObjectTarget.cpp | ||
3536–3537 ↗ | (On Diff #186481) | Either NULL check or change the API? |
source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | ||
2865–2866 ↗ | (On Diff #186481) | Either NULL check or change the API? |
source/Plugins/Process/Utility/RegisterContextLLDB.cpp | ||
242–243 ↗ | (On Diff #186481) | Either NULL check or change the API? |
674–675 ↗ | (On Diff #186481) | Either NULL check or change the API? |
776–777 ↗ | (On Diff #186481) | Either NULL check or change the API? |
795 ↗ | (On Diff #186481) | Either NULL check or change the API? |
805 ↗ | (On Diff #186481) | Either NULL check or change the API? |
Changed Module::GetUnwindTable to return a referece. I also changed the
UnwindTable to internally store a Module& (instead of ObjectFile&), to make sure
it always has something to hold on to.
include/lldb/Core/Module.h | ||
---|---|---|
709 ↗ | (On Diff #186481) | There isn't much point in having a const version of this, as all UnwindTable methods are non-const. |
Just a question of if we need an optional unwind table instance instead of just an instance. I am fine either way.
include/lldb/Core/Module.h | ||
---|---|---|
1108–1110 ↗ | (On Diff #186599) | Any reason to not just have a UnwindTable instance here? The accessor can't fail, so one must be created anyway right? |
include/lldb/Core/Module.h | ||
---|---|---|
1108–1110 ↗ | (On Diff #186599) | The difference is in when it gets created. The regular instance would have to be created together with the Module. However, that shouldn't really matter, as UnwindTable is internally lazily initialized as well, so I'll just remove the optional. We may need to do something smarter here anyway once we start re-initializing the unwind info due to symbol file changes. |