<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 3, 2019, at 10:05 AM, Alexander Polyakov via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;">Hi lldb-dev,<br class=""><br class="">Currently I'm working on an OS plug-in for multiple operating systems and architectures, during my work, I noted a few moments I want to discuss with the community.<br class=""><br class="">1) Adding RegisterContext to SB API:<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Are you asking for the ability to create external native plug-ins instead of the python OS plug-in interface? </div><div><blockquote type="cite" class=""><div dir="ltr" class=""><div dir="ltr" class=""></div></div></blockquote></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;"> if you want your OS plug-in to support multiple architectures you need to implement</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;"> things like <b class="">get_register_info, get_register_data...</b> for each architecture.<br class=""> In my mind, we could do that using RegisterContext, for example: <br class=""> <b class="">get_register_info</b> could just call RegisterContext::GetRegisterContextAtIndex(idx), the number <br class=""> of registers could be obtained from RegisterContext::GetRegisterCount();<br class=""></div></div></div></div></blockquote><div><br class=""></div>What is missing from the python OS plug-in interface here? A register context represents all of the registers so I don't follow what you mean with what is stated above about asking for a register context by index. So you want multiple architectures to show up in the same process? If so this will require many changes to LLDB as each thread currently is assumed to have the same architecture as the process.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;"> <b class="">get_register_data </b>could return SBRegisterContext instead of just bytes, then the process of</div><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;"> fetching the register values might look as: for each register <br class=""> SBRegisterContext::WriteRegister(reg_info, reg_value).<br class=""> Please correct me if I'm missing something.<br class=""></div></div></div></div></blockquote><div><br class=""></div>I know the python OS plug-in doesn't have the ability to write a register right now. Again, a RegisterContext is a group of all of the register for a thread, so I am not sure SBRegisterContext is the right naming here. </div><div><br class=""></div><div>If we do make native plug-in we could do things very similar to the python OS plug-in:</div><div>- Define the registers for threads, possibly adding the ability to specify more than one register context to allow different threads to have different registers. This register context would define which registers are available, how they are grouped, etc.</div><div>- For each thread, figure out which register context it will use from one of the register layouts that was specified in above step</div><div>- allow read/write access to registers</div><div><br class=""></div><div>The python OS plug-in has the ability to define a single different register context for threads, and the ability read registers. The architecture is assumed to be the same. </div><div><div><br class=""></div></div><div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family: arial, helvetica, sans-serif; font-size: small;"><br class="">2) New lldb-mi command: -info-os<br class=""> the gdb-mi documentation defines this command and there is a problem with it. To fully<br class=""> implement it, we should be able to get CPU ID a thread is running on, but lldb<br class=""> does not have an abstraction for CPU ID at all, so it becomes unreal at least for now.<br class=""> I'm going to partly implement this command for Zephyr (e.g. return some value to indicate <br class=""> that the CPU ID is undefined) and I want to know if the community is interested in implementing<br class=""> that command inside lldb-mi (at least in part).</div></div></div></div></blockquote><div><br class=""></div>We could implement the ability for a target to have registers for registers that are globally accessible, like the CPU ID register. Any register that has a single value for all threads in a process would fall into this category. The discovery and reading and writing would be very similar to lldb_private::RegisterContext, just a different set.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="m_5204971009704125322gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><span style="font-family: arial, helvetica, sans-serif; font-size: 12.8px;" class="">Alexander</span><br class=""></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></body></html>