Seems like this class was added for testing. RegisterInfoInterface is a class 
that creates a common API for getting lldb_private::RegisterInfo structures.  

A RegisterContext<OS>_<Arch> class uses one of these to be able to create a 
buffer large enough to store all registers defined in the RegisterInfoInterface 
and will actually read/write there registers to/from the debugged process. 
RegisterContext also caches registers values so they don't get read multiple 
times when the process hasn't resumed. A RegisterContext subclass is needed for 
each architecture so we can dynamically tell LLDB what the registers look like 
for a given architecture. It also provides abstractions by letting each 
register define its registers numbers for Compilers, DWARF, and generic 
register numbers like PC, SP, FP, return address, and flags registers. This 
allows the generic part of LLDB to say "I need you to give me the PC register 
for this thread" and we don't need to know that the register is "eip" on x86, 
"rip" on x86_64, "r15" on ARM. RegisterContext classes can also determine how 
registers are read/written: one at a time, or "get all general purpose regs" 
and "get all FPU regs". So if someone asks a RegisterContext to read the PC, it 
might go read all GPR regs and then mark them all as valid in the register 
context buffer cache, so if someone subsequently asks for SP, it will be 
already cached. 

So RegisterInfoInterface defines a common way that many RegisterContext classes 
can inherit from in order to give out the lldb_private::RegisterInfo (which is 
required by all subclasses of RegisterContext) info for a register context, and 
RegisterContext is the one that actually will interface with the debugged 
process in order to read/write and cache those registers as efficiently as 
possible for the current program being debugged.

> On Sep 12, 2017, at 10:59 PM, Ramana via lldb-dev <lldb-dev@lists.llvm.org> 
> wrote:
> 
> Hi,
> 
> When deriving RegisterContext<OS>_<Arch>, why some platforms (Arch+OS)
> are deriving it from lldb_private::RegisterContext while others are
> deriving from lldb_private::RegisterInfoInterface or in other words
> how to decide on the base class to derive from between those two and
> what are the implications?
> 
> Thanks,
> Ramana
> _______________________________________________
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to