<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hello lldb developers,</p>
<p><br>
</p>
<p>In one of the older posts (<a href="http://blog.llvm.org/2015/01/lldb-is-coming-to-windows.html" class="OWAAutoLink" id="LPlnk894957">http://blog.llvm.org/2015/01/lldb-is-coming-to-windows.html</a>), symbol server support was mentioned. Most likely it was
 meant for Windows, but at FB we have our own symbol server implementation for Linux (technically it's completely platform agnostic), which we would like to integrate with LLDB and eventually open source along with the server. As such I thought I'd ask LLDB
 gurus like you, if anyone is already working on symbol server support and if not, I'd appreciate your thoughts on a desired architecture.</p>
<p><br>
</p>
<p>General idea.</p>
<p>Based on current LLDB implementation and the fact that symbol server feature is a cross-cutting concern, the natural place to put this logic would be inside SymbolVendor plugin, which on Mac is used to resolve separate dSYM bundles. In theory symbol server
 logic is completely platform-agnostic, as all we need to know is some sort of binary ID (could either be a real .build-id or UUID or some custom logic to compute a stable binary hash) and binary name. This info can be used to make a network request to check
 whether corresponding binary exists and if so, download it to a temporary location and call <span>symbol_vendor->AddSymbolFileRepresentation with FileSpec pointing at that temporary location.</span></p>
<p><span><br>
</span></p>
<p><span>Implementation details.</span></p>
<p><span><br>
</span></p>
<p><span>Logic placement.</span></p>
<p><span>Even though symbol resolution is platform agnostic, the process of extracting/computing binary ID is. As such it seems like SymbolServerResolver can either be a part of LLDB core, or a separate directory in Plugins/SymbolVendor, which will then be
 used by SymbolVendorELF and SymbolVendorMacOSX. First both symbol vendors will try to resolve the symbols the way they currently do and only if they cannot find anything, will they try to use SymbolVendorSymbolServer.</span></p>
<p>Alternatively symbol server resolution logic can be placed into its own SymbolVendorSymbolServer, and modify SymbolVendor FindPlugin's logic such that it does not return the first found SymbolVendor instance and instead returns either the first SymbolVendor
 instance that managed to successfully resolve symbols or just last one.</p>
<p>Yet another alternative would be to use a delegation chain, such that any SymbolVendor could be wrapped into a SymbolVendorSymbolServer, which would first try to invoke the delegate and if it cannot find symbols, will try to perform its magic. This approach
 seems nice, but does not play nice with current implementation based on static factory method.</p>
<p><span><br>
</span></p>
<p><span>Symbol server communication.</span></p>
<p><span>Network communication can either be implemented natively for different platforms or it can be delegated to a python script invoked by ScriptInterpreter. Using Python seems an easier option in order to make this cross-platform, but it adds a dependency
 on Python and will require propagating ScriptInterpreter to SymbolVendor creation factory.</span></p>
<p><span><br>
</span></p>
<p><span>Thoughts, suggestions and comments are very welcome.</span></p>
<p><span><br>
</span></p>
<p><span>Thank you,</span></p>
<p><span>Taras</span></p>
<div id="LPBorder_GT_14703327535410.5182283317476308" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14703327535380.011026752022188058" cellspacing="0" style="width: 90%; position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200); background-color: rgb(255, 255, 255);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_14703327535390.6142181755832397" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_14703327535400.42599437410565977"></div>
<div id="LPTitle_14703327535400.45860326168279064" style="top: 0px; color: rgb(0, 120, 215); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14703327535400.45319532006736085" href="http://blog.llvm.org/2015/01/lldb-is-coming-to-windows.html" target="_blank" style="text-decoration: none;">LLVM Project Blog: LLDB is Coming to Windows</a></div>
<div id="LPMetadata_14703327535400.5399652255448155" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
blog.llvm.org</div>
<div id="LPDescription_14703327535400.6174857090501791" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
This preliminary bootstraping work is mostly complete, and you can use LLDB to debug simple executables generated with Clang on Windows today.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</body>
</html>