<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’d like to add another use case. On Hexagon, we talk to a simulator using gdb-remote. We hacked gdb to have “run” launch and connect to the simulator, and “start” do a “run”, then break at main and continue. I’ve implemented this in our lldb solution using python.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’d like to be able to have “run” be able to launch a supplied executable, then connect to it via gdb-remote (or another protocol).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> lldb-dev-bounces@cs.uiuc.edu [mailto:lldb-dev-bounces@cs.uiuc.edu] <b>On Behalf Of </b>Zachary Turner<br><b>Sent:</b> Tuesday, September 16, 2014 3:26 PM<br><b>To:</b> Todd Fiala<br><b>Cc:</b> lldb-dev@cs.uiuc.edu<br><b>Subject:</b> Re: [lldb-dev] Process spawning and shutdown<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Sure, but debugserver still has to launch processes locally w/r/t itself, so this code would jsut be used there instead of in lldb. Also, it's not clear what the timeline is and waiting would jsut be lost time, so even if some of what I do now has to be redone in the debugserver world, it's still better than being blocked now and not being able to do anything :)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Tue, Sep 16, 2014 at 1:12 PM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>> <span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>For now, the abstraction I'm creating deals only with local processes. </span><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>For MacOSX, the local process uses debugserver for debugging (i.e. it is always remote w/r/t process startup --- lldb will launch and debugserver will attach).</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Linux is moving this way as well once we (1) get llgs passing the local test suite with llgs in place of ProcessLinux/ProcessMonitor, and (2) get llgs supporting the existing set of ProcessLinux/ProcessMonitor cpu architectures. It will be on a PlatformLinux switch that defaults to current TOT behavior until then. (See <a href="http://github.com/tfiala/lldb" target="_blank">http://github.com/tfiala/lldb</a> in the dev-llgs-local-launch branch for current state).</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Not sure that affects anything but wanted to be clear on it.</span><o:p></o:p></p></div></div><div><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Tue, Sep 16, 2014 at 12:26 PM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>Yea, I saw that as well. For now, the abstraction I'm creating deals only with local processes. However, it has an interface that would in theory allow a RemoteProcess to derive from it, so that local and remote processes could be managed transparently.<o:p></o:p></p></div><div><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Tue, Sep 16, 2014 at 12:07 PM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>Don't forget we also have launching via Platform classes, which can end up kicking off a gdb-remote request to a lldb-platform or gdb-remote stub (llgs/debugserver).<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Also, ProcessGDBRemote is capable of kicking those off if it's using gdb-remote locally.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>So, if nothing else, there's the concept of a "launch via another mechanism."<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal>On Tue, Sep 16, 2014 at 11:55 AM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<o:p></o:p></p></div></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><div><p class=MsoNormal>The last major piece of the Host layer I'd like to address is process launching and cleanup. From looking over the code it seems we have the following different ways to launch a process:<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>MacOSX:<o:p></o:p></p></div><div><p class=MsoNormal> * Applescript<o:p></o:p></p></div><div><p class=MsoNormal> * XPC<o:p></o:p></p></div><div><p class=MsoNormal> * posix_spawn<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Other posix variants:<o:p></o:p></p></div><div><p class=MsoNormal> * posix_spawn<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Windows:<o:p></o:p></p></div><div><p class=MsoNormal> * Native windows launcher<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Among these, there are a couple of different ways to reap processes on exit and/or "join" on them. These are:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal>MacOSX:<o:p></o:p></p></div><div><p class=MsoNormal> * Applescript [ No process reaping or monitoring occurs. ]<o:p></o:p></p></div><div><p class=MsoNormal> * XPC [ Uses MacOSX-specific dispatch library for monitoring ]<o:p></o:p></p></div><div><p class=MsoNormal> * posix_spawn [ Uses MacOSX-specific dispatch library for monitoring ]<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Other posix variants:<o:p></o:p></p></div><div><p class=MsoNormal> * posix_spawn [ Launches a background thread to monitor for process exit, join on the thread to join on the process ]<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Windows:<o:p></o:p></p></div><div><p class=MsoNormal> * Native windows launcher [ WaitForSingleObject ]<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>A few questions: <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>1) Is Join() on a process a useful operation that people would be interested in seeing implemented for all platforms?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>2) On Linux at least, if you don't waitpid() on a process you'll end up with zombies. It seems this is true on MacOSX as well, because I see waitpid() in StartMonitoringChildProcess. Is this not true for the Applescript launcher? Why doesn't the Applescript launching code path call StartMonitoringChildProcess() anywhere?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>3) Speaking of the Applescript launcher, what is it and what is it used for?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I'll probably have more questions as I wrap my head around this a little more. Thanks<o:p></o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'>_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><span style='color:#888888'><br><br clear=all><o:p></o:p></span></p><div><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div><p class=MsoNormal><span style='color:#888888'>-- <o:p></o:p></span></p><div><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0><tr><td nowrap style='border:none;border-top:solid #D50F25 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#555555'>Todd Fiala |<o:p></o:p></span></p></td><td nowrap style='border:none;border-top:solid #3369E8 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#555555'> Software Engineer |<o:p></o:p></span></p></td><td nowrap style='border:none;border-top:solid #009939 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#555555'> <a href="mailto:tfiala@google.com" target="_blank"><span style='color:#222222;background:#FFFFCC'>tfiala@google.com</span></a> |<o:p></o:p></span></p></td><td nowrap style='border:none;border-top:solid #EEB211 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#1155CC'> 650-943-3180</span><span style='font-family:"Arial","sans-serif";color:#555555'><o:p></o:p></span></p></td></tr></table><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div><p class=MsoNormal><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <o:p></o:p></p><div><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0><tr><td nowrap style='border:none;border-top:solid #D50F25 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#555555'>Todd Fiala |<o:p></o:p></span></p></td><td nowrap style='border:none;border-top:solid #3369E8 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#555555'> Software Engineer |<o:p></o:p></span></p></td><td nowrap style='border:none;border-top:solid #009939 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#555555'> <a href="mailto:tfiala@google.com" target="_blank"><span style='color:#222222;background:#FFFFCC'>tfiala@google.com</span></a> |<o:p></o:p></span></p></td><td nowrap style='border:none;border-top:solid #EEB211 1.5pt;padding:0in 0in 0in 0in'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#1155CC'> 650-943-3180</span><span style='font-family:"Arial","sans-serif";color:#555555'><o:p></o:p></span></p></td></tr></table><p class=MsoNormal><o:p> </o:p></p></div></div></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>