This is an archive of the discontinued LLVM Phabricator instance.

Move UnwindTable from ObjectFile to Module
ClosedPublic

Authored by labath on Feb 12 2019, 8:29 AM.

Details

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Feb 12 2019, 8:29 AM
clayborg requested changes to this revision.Feb 12 2019, 8:46 AM

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?

This revision now requires changes to proceed.Feb 12 2019, 8:46 AM
labath updated this revision to Diff 186599.Feb 13 2019, 1:18 AM

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.

labath marked an inline comment as done.Feb 13 2019, 1:19 AM
labath added inline comments.
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.

clayborg accepted this revision.Feb 13 2019, 11:40 AM

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?

This revision is now accepted and ready to land.Feb 13 2019, 11:40 AM
labath marked 3 inline comments as done.Feb 14 2019, 6:25 AM
labath added inline comments.
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.

This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2019, 6:43 AM