<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 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
.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="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText">Ill have to talk to the powers to be but for the most part I could check it in. There is an internal json format that the tool saves it into and a bit of it is geared towards Blizzard Entertainment server setup though but for the most
part its pretty simple (under 1000 lines).<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">
<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Mark Chandler<o:p></o:p></p>
<p class="MsoPlainText">Battle.Net Engineering Systems | Blizzard Entertainment<o:p></o:p></p>
<p class="MsoPlainText">(P) 949-955-1380 x15353<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">-----Original Message-----<br>
From: Greg Clayton [mailto:gclayton@apple.com] <br>
Sent: Tuesday, November 03, 2015 4:49 PM<br>
To: Mark Chandler <mchandler@blizzard.com><br>
Cc: lldb-dev@lists.llvm.org<br>
Subject: Re: [lldb-dev] Attaching to a stopped (cored) process hangs lldb-server</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Can someone with linux experience chime in here? It shouldn't be too hard to figure out which flag 'S' is in. On MacOS we can get a process info structure from a pid and that will have bits set that indicate 'S'...<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">If you want to checkin this tool into the LLDB source tree at trunk/tools/core_tool then we can get more people to work on it and improve it. It would be nice to have this available for all linux users. I would love to see an JSON output
mode that is parseable by automated tools instead of people saving text formats that must be text scraped.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">If you can get this into a tool, others can help get this working. Any interest in this?<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Greg<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">> On Nov 3, 2015, at 4:41 PM, Mark Chandler <<a href="mailto:mchandler@blizzard.com"><span style="color:windowtext;text-decoration:none">mchandler@blizzard.com</span></a>> wrote:<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> The biggest tell is that the process state is already 'S' or stopped. I don’t know lldb at all to make a change to fix this though.<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Mark Chandler<o:p></o:p></p>
<p class="MsoPlainText">> Battle.Net Engineering Systems | Blizzard Entertainment<o:p></o:p></p>
<p class="MsoPlainText">> (P) 949-955-1380 x15353<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> -----Original Message-----<o:p></o:p></p>
<p class="MsoPlainText">> From: Greg Clayton [<a href="mailto:gclayton@apple.com"><span style="color:windowtext;text-decoration:none">mailto:gclayton@apple.com</span></a>]
<o:p></o:p></p>
<p class="MsoPlainText">> Sent: Tuesday, November 03, 2015 4:39 PM<o:p></o:p></p>
<p class="MsoPlainText">> To: Mark Chandler <<a href="mailto:mchandler@blizzard.com"><span style="color:windowtext;text-decoration:none">mchandler@blizzard.com</span></a>><o:p></o:p></p>
<p class="MsoPlainText">> Cc: <a href="mailto:lldb-dev@lists.llvm.org"><span style="color:windowtext;text-decoration:none">lldb-dev@lists.llvm.org</span></a><o:p></o:p></p>
<p class="MsoPlainText">> Subject: Re: [lldb-dev] Attaching to a stopped (cored) process hangs lldb-server<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Makes sense about not writing the core file to disk. <o:p>
</o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Is there a way you can detect this "core" mode where we don't have to waitpid? Seems like that
<a href="http://www.sourceware.org"><span style="color:windowtext;text-decoration:none">www.sourceware.org</span></a> message had ideas on how to detect this case?<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Greg<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">>> On Nov 3, 2015, at 4:36 PM, Mark Chandler <<a href="mailto:mchandler@blizzard.com"><span style="color:windowtext;text-decoration:none">mchandler@blizzard.com</span></a>> wrote:<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> Not able to do that as the servers have no hard drives (use ram disk and net boot) and the tool is trying to avoid a core storm that takes down the network file share. I found out what is causing it to hang, there is a call to waitpid
in NativeLinuxProcess.cpp that waits forever. As the process is already stopped, I disabled that and it looks to be working<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> Mark Chandler<o:p></o:p></p>
<p class="MsoPlainText">>> Battle.Net Engineering Systems | Blizzard Entertainment<o:p></o:p></p>
<p class="MsoPlainText">>> (P) 949-955-1380 x15353<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> -----Original Message-----<o:p></o:p></p>
<p class="MsoPlainText">>> From: Greg Clayton [<a href="mailto:gclayton@apple.com"><span style="color:windowtext;text-decoration:none">mailto:gclayton@apple.com</span></a>]
<o:p></o:p></p>
<p class="MsoPlainText">>> Sent: Tuesday, November 03, 2015 4:34 PM<o:p></o:p></p>
<p class="MsoPlainText">>> To: Mark Chandler <<a href="mailto:mchandler@blizzard.com"><span style="color:windowtext;text-decoration:none">mchandler@blizzard.com</span></a>><o:p></o:p></p>
<p class="MsoPlainText">>> Cc: <a href="mailto:lldb-dev@lists.llvm.org"><span style="color:windowtext;text-decoration:none">lldb-dev@lists.llvm.org</span></a><o:p></o:p></p>
<p class="MsoPlainText">>> Subject: Re: [lldb-dev] Attaching to a stopped (cored) process hangs lldb-server<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> One different approach is to have your tool write all STDIN to a file (the core file comes into the tool as STDIN bytes) and then hand LLDB the core file and do any needed backtracing and data gathering from the core file instead
of actually attaching to the process for real. All executable and shared library object files (ELF files) from the core file are still on disk so you can get symbols and use the debug info, so LLDB should be able to load all frames up and symbolicate up the
crash location. It should be just as good as having the process around without any bad side affects. Core files are less useful if they must be archived and symbolicated later because the executable files might not be around anymore since things like test
suites might produce binaries for testing and remove them after the test is run or crashed.<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> What do you think about this approach?<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> Greg Clayton<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>>> On Nov 2, 2015, at 5:54 PM, Mark Chandler via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org"><span style="color:windowtext;text-decoration:none">lldb-dev@lists.llvm.org</span></a>> wrote:<o:p></o:p></p>
<p class="MsoPlainText">>>> <o:p></o:p></p>
<p class="MsoPlainText">>>> So im trying to write a core handler program and use lldb to attach and dump important information about it. This works if a use my tool to attach to an existing one but I found that lldb-server will hang in a waitpid call if the
kernel has invoked the tool after another process has cored.<o:p></o:p></p>
<p class="MsoPlainText">>>> <o:p></o:p></p>
<p class="MsoPlainText">>>> Example:<o:p></o:p></p>
<p class="MsoPlainText">>>> · /proc/sys/kernel/core_pattern is set to |/opt/core_tool<o:p></o:p></p>
<p class="MsoPlainText">>>> · Run a.out and it segfaults<o:p></o:p></p>
<p class="MsoPlainText">>>> · Kernel invokes core_tool that uses lldb AttachToProcess and a.out is in state “S+”<o:p></o:p></p>
<p class="MsoPlainText">>>> · lldb-server hangs in source\Plugins\Process\Linux\NativeProcessLinux.cpp:867<o:p></o:p></p>
<p class="MsoPlainText">>>> · if I remove the waitpid it doesn’t hang but fails to attach<o:p></o:p></p>
<p class="MsoPlainText">>>> <o:p></o:p></p>
<p class="MsoPlainText">>>> Looks like gdb had a similar problem as well: <a href="http://www.sourceware.org/ml/gdb-patches/2008-04/msg00224.html">
<span style="color:windowtext;text-decoration:none">http://www.sourceware.org/ml/gdb-patches/2008-04/msg00224.html</span></a><o:p></o:p></p>
<p class="MsoPlainText">>>> Any ideas on how to fix this?<o:p></o:p></p>
<p class="MsoPlainText">>>> <o:p></o:p></p>
<p class="MsoPlainText">>>> Mark Chandler<o:p></o:p></p>
<p class="MsoPlainText">>>> Battle.Net Engineering Systems | Blizzard Entertainment<o:p></o:p></p>
<p class="MsoPlainText">>>> (P) 949-955-1380 x15353<o:p></o:p></p>
<p class="MsoPlainText">>>> <o:p></o:p></p>
<p class="MsoPlainText">>>> _______________________________________________<o:p></o:p></p>
<p class="MsoPlainText">>>> lldb-dev mailing list<o:p></o:p></p>
<p class="MsoPlainText">>>> <a href="mailto:lldb-dev@lists.llvm.org"><span style="color:windowtext;text-decoration:none">lldb-dev@lists.llvm.org</span></a><o:p></o:p></p>
<p class="MsoPlainText">>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev">
<span style="color:windowtext;text-decoration:none">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</span></a><o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
</div>
</body>
</html>