This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add support for the DW_AT_trampoline attribute with a boolean
AcceptedPublic

Authored by augusto2112 on Mar 30 2023, 7:08 PM.

Details

Summary

This patch adds support for the DW_AT_trampoline attribute whose value
is a boolean. Which is a "generic trampoline". Stepping into a generic
trampoline by default will step through the function, checking
at every branch, until we stop in a function which makes sense to stop
at (a function with debug info, which isn't a trampoline, for example).

Diff Detail

Event Timeline

augusto2112 created this revision.Mar 30 2023, 7:08 PM
Herald added a project: Restricted Project. · View Herald Transcript
augusto2112 requested review of this revision.Mar 30 2023, 7:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 7:08 PM

There seems to be overlap in the code added in this patch and D146679. Does one supersede the other or is there a dependency? If it's the latter you should extract that into a separate patch and make it a parent revision of this and D146679.

There seems to be overlap in the code added in this patch and D146679. Does one supersede the other or is there a dependency? If it's the latter you should extract that into a separate patch and make it a parent revision of this and D146679.

Yes, sorry, I'm abandoning the other one in favor of this one.

JDevlieghere added inline comments.Apr 2 2023, 1:09 PM
lldb/source/Core/Module.cpp
780

You can hoist target::GetGlobalProperties().GetEnableTrampolineSupport() out of the loop. Right now it will need to be recomputed every time in because someone could change the setting in the meantime and although it's a little far fetched, that's probably not what you want anyway.

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
2443

Let's make this const for consistence with func_user_id (and remove the newline as they're related).

lldb/source/Target/ThreadPlanStepRange.cpp
509–527

I know you copy pasted this but this can be simplified quite a bit.

There seems to be overlap in the code added in this patch and D146679. Does one supersede the other or is there a dependency? If it's the latter you should extract that into a separate patch and make it a parent revision of this and D146679.

Yes, sorry, I'm abandoning the other one in favor of this one.

Be handy to mark this abandoned when you get a chance

Be handy to mark this abandoned when you get a chance

Augusto had already abandoned it when he wrote that reply, maybe you're looking at a different patch or stale tab?

augusto2112 marked 3 inline comments as done.

Addressed comments

aprantl added inline comments.Apr 10 2023, 3:02 PM
lldb/include/lldb/Symbol/Function.h
439

Is the "generic" qualifier necessary here? If we later add support for trampolines with a jump target maybe, but without that this seems to just create opportunity for confusion, particularly for Swift where the word "generic" has very different connotations.

lldb/source/Target/ThreadPlanStepThroughGenericTrampoline.cpp
3

formatting

JDevlieghere accepted this revision.Apr 14 2023, 10:39 AM

LGTM with Adrian's and my comments addressed.

lldb/include/lldb/Symbol/Function.h
439

I wondered that too, but assumed we were still planning to support trampolines with a target. If not, then +1 on making this just "trampoline".

lldb/source/Target/ThreadPlanStepRange.cpp
520–522
LLDB_LOG(GetLog(LLDBLog::Step), "ThreadPlanStepRange got asked if it explains the stop for some reason other than step.");
This revision is now accepted and ready to land.Apr 14 2023, 10:39 AM