[Lldb-commits] [PATCH] D109249: [lldb] Add Getdescription function for SBInstruction.

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 8 10:03:16 PDT 2021

jingham added a comment.

Would it be better to make an API that takes an SBExecutionContext?  If you knew the frame that held

In D109249#2988808 <https://reviews.llvm.org/D109249#2988808>, @labath wrote:

> I'm not sure what's the exact use case here, but I /think/ that passing just the target part of the execution context will is not sufficient to enable all the disassembler bells and whistles. For example the regular "disassemble" command will also print a "-> " next to the instruction that references the current PC.
> Even if that is not required for your use case, I think that a better (more generic) API would be for this function to take a SBExecutionContext argument, and let the user choose how it wants to populate it.

I thought the same thing, but then I got to wondering what you should do when the SBExecutionContext you were passed in has a frame with a PC that doesn't point to the instruction you were passed.  Is that an error?  Does it matter?

I still think the SBExecutionContext is a better choice, and will prevent us from having to add another override later on when we find we need the thread or frame.  But we should decide up front whether we want there to be any linkage between the exact ExecutionContext and the instruction you are dumping.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list