<div dir="ltr">Hi Vincent,<div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 20, 2018 at 9:23 AM,  <span dir="ltr"><<a href="mailto:Vincent.Blondeau@lamresearch.com" target="_blank">Vincent.Blondeau@lamresearch.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_8814439689925170980WordSection1">
<p class="MsoNormal" style="margin-left:.5in"><b>From:</b> Vm-dev [mailto:<a href="mailto:vm-dev-bounces@lists.squeakfoundation.org" target="_blank">vm-dev-bounces@lists.<wbr>squeakfoundation.org</a>]
<b>On Behalf Of </b>Ben Coman<br>
<b>Sent:</b> Thursday, April 19, 2018 19:00<br>
<b>To:</b> Open Smalltalk Virtual Machine Development Discussion <<a href="mailto:vm-dev@lists.squeakfoundation.org" target="_blank">vm-dev@lists.<wbr>squeakfoundation.org</a>><br>
<b>Subject:</b> Re: [Vm-dev] VM debugging - breakpoint issue on Windows<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">On 20 April 2018 at 07:45, <<a href="mailto:Vincent.Blondeau@lamresearch.com" target="_blank">Vincent.Blondeau@lamresearch.<wbr>com</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> *From:* Vm-dev [mailto:<a href="mailto:vm-dev-bounces@lists.squeakfoundation.org" target="_blank">vm-dev-bounces@lists.<wbr>squeakfoundation.org</a>] *On<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> Behalf Of *Eliot Miranda<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> *Sent:* Thursday, April 19, 2018 14:08<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> *To:* Open Smalltalk Virtual Machine Development Discussion <vm-dev@lists.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> <a href="http://squeakfoundation.org" target="_blank">squeakfoundation.org</a>><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> *Subject:* Re: [Vm-dev] VM debugging - breakpoint issue on Windows<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> Hi Vincent,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > On Apr 19, 2018, at 1:49 PM, <<a href="mailto:Vincent.Blondeau@lamresearch.com" target="_blank">Vincent.Blondeau@lamresearch.<wbr>com</a>> <<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> <a href="mailto:Vincent.Blondeau@lamresearch.com" target="_blank">Vincent.Blondeau@lamresearch.<wbr>com</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > Hi all,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > So I tested an hello world project, by trying different compilation<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> options. Knowing that the ones that are in use to generate the .exe are:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > -mwindows -m32 -mthreads -Wl,--large-address-aware,--<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> dynamicbase,--nxcompat,--<wbr>export-all-symbols<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > I identified that having all the options expect export-all-symbols,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> works perfectly.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > And having all the options except dynamicbase works too.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> Great, thanks!<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > I suppose that the options of the linker dynamicbase and<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> export-all-symbols are conflicting and avoid to debug the app.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > I will try to remove one and retry with the VM.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> > BTW, I have no idea of what these options do…<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> export-all-symbols tells the linker that all non-static symbols should be<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> made available to dlls.  In Windows, exporting is by a funky mechanism, an<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> export table, instead of, as in Unix, by run-time/load-time linking.  Using<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> export-all-symbols avoids us having to use a .def file to specify the<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> exports we need.  So if you find out that things work properly without<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> export-all-symbols then we shall have to maintain a .def file.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> Bah...<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> I removed both options and recompiled, your breakpoint is reached  in<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> parseVMArgs !<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">Did that the produce a DEF file? which gdb would have loaded symbols from?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Yes, it did. See attachment<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">With the original compile options, did you try...<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">$ gdb <executable><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">> dll-symbols <dllname.dll><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">per libin_v's answer here...<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__www.experts-2Dexchange.com_questions_23792765_How-2Dto-2Ddebug-2Da-2DDLL-2Dusing-2DMinGW.html&d=DwIFaQ&c=RWI7EqL8K9lqtga8KxgfzvOYoob76EZWE0yAO85PVMQ&r=kIZIYXBAA3fhM7P5HOuTC5w6mnEApTfXPTq3lR34ZiY&m=VTBZ347Znkcb19dYAJpyGZbBH9kSN94xqgGbyASiY68&s=FMXQC5QfsEaoN2zTiVeKE1jgSwYDqtgbcOX9oiMQZkE&e=" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__www.<wbr>experts-2Dexchange.com_<wbr>questions_23792765_How-2Dto-<wbr>2Ddebug-2Da-2DDLL-2Dusing-<wbr>2DMinGW.html&d=DwIFaQ&c=<wbr>RWI7EqL8K9lqtga8KxgfzvOYoob76E<wbr>ZWE0yAO85PVMQ&r=<wbr>kIZIYXBAA3fhM7P5HOuTC5w6mnEApT<wbr>fXPTq3lR34ZiY&m=<wbr>VTBZ347Znkcb19dYAJpyGZbBH9kSN9<wbr>4xqgGbyASiY68&s=<wbr>FMXQC5QfsEaoN2zTiVeKE1jgSwYDqt<wbr>gbcOX9oiMQZkE&e=</a><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">(disclaimer, I'm not familiar with it.  Its just interesting to search around learning more about it.)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal">I did not export the plugin as a DLL, the function I added is in an internal plugin. So it is embedded in the Pharo.exe.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">-------------<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.5in">Also, here is a suggestion that dynamicbase Address Space Layout<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">Randomization may cause a problem with gdb (maybe a gdb bug)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.gnu.org_archive_html_qemu-2Ddiscuss_2016-2D04_msg00043.html&d=DwIFaQ&c=RWI7EqL8K9lqtga8KxgfzvOYoob76EZWE0yAO85PVMQ&r=kIZIYXBAA3fhM7P5HOuTC5w6mnEApTfXPTq3lR34ZiY&m=VTBZ347Znkcb19dYAJpyGZbBH9kSN94xqgGbyASiY68&s=-LGIXGLImWQUDpFZvMnBEr-3YP6qSZG0GCbckgRa0GA&e=" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__lists.<wbr>gnu.org_archive_html_qemu-<wbr>2Ddiscuss_2016-2D04_msg00043.<wbr>html&d=DwIFaQ&c=<wbr>RWI7EqL8K9lqtga8KxgfzvOYoob76E<wbr>ZWE0yAO85PVMQ&r=<wbr>kIZIYXBAA3fhM7P5HOuTC5w6mnEApT<wbr>fXPTq3lR34ZiY&m=<wbr>VTBZ347Znkcb19dYAJpyGZbBH9kSN9<wbr>4xqgGbyASiY68&s=-<wbr>LGIXGLImWQUDpFZvMnBEr-<wbr>3YP6qSZG0GCbckgRa0GA&e=</a><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal">Interesting! But, for the debug version, we may not need of these options, may we?</p></div></div></blockquote><div><br></div><div>Indeed; minnow may have chosen to make the effect of export-all-symbols on by default, which would be great.  We have to research.  The issue is this:</div><div>- there are functions exported by the VM to plugins through the interpreterProxy/sqVirtualMachine interface; these are fine; they're marked export</div><div>- there are functions exported implicitly from the graphics subsystem to certain external graphics plugins (IIRC B3DAccelleratorPlugin).  These are not fine.  It used to be that to get visibility of these functions in the plains one had to use export-all-symbols.  </div><div><br></div><div>So we have to carefully test the VM compiled without export-all-symbols to know that things are OK.  after today I will have a look at the lists of exported and  imported symbols in at least the Mac and Linux VMs and try and identify some symbols that are not explicitly exported.  We can then see if they're also used on Wndows and then test whether the access works.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div class="m_8814439689925170980WordSection1">
<p class="MsoNormal">Also, I am successfully debugging the primitive I am writing.</p></div></div></blockquote><div><br></div><div>That's good news.</div></div><br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>