<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;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-compose;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You should be able to directly debug in visual studio. Build and run lli with your hw-m32.ll added to the debug args. Make sure you do a debug build. The assert should cause the visual studio debugger to break and you can examine the call
 stack and figure out relevant breakpoints to set.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Francis ANDRE via llvm-dev<br>
<b>Sent:</b> Tuesday, March 9, 2021 10:34 AM<br>
<b>To:</b> LLVM Developers' List <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
<b>Subject:</b> [EXT] [llvm-dev] Help: Windows: lli crashes on 32 arch but not on 64 arch<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello LLVM list<o:p></o:p></p>
<p>I am running with lli,  a simple HelloWorld program twice, once targeted to 32 bits arch, the other targeted to 64 bit arch. While it is working fine with the 64 arch, it craches with the 32 arch. Below are the steps<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>clang.cmd -v -g -m64 -emit-llvm -S hw.c -o hw-m64.ll<o:p></o:p></p>
<p><o:p> </o:p></p>
<p class="MsoNormal">clang.cmd -v -g -m32 -emit-llvm -S hw.c -o hw-m32.ll<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">C:\Program Files (x86)\LLVM\11.0\bin"\clang -v -g -m32 -emit-llvm -S e.c -o e-m32.ll<br>
clang version 11.0.0<br>
Target: i686-pc-windows-msvc<br>
Thread model: posix<br>
InstalledDir: C:\Program Files (x86)\LLVM\11.0\bin<br>
 (in-process)<br>
 "C:\\Program Files (x86)<a href="file://LLVM/11.0/bin/clang.exe">\\LLVM\\11.0\\bin\\clang.exe</a>" -cc1 -triple i686-pc-windows-msvc19.28.29335 -emit-llvm -disable-free -disable-llvm-verifier -discard-value-names -main-file-name e.c -mrelocation-model static
 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -target-cpu pentium4 -gno-column-info -gcodeview -debug-info-kind=limited -v -resource-dir "C:\\Program Files (x86)<a href="file://LLVM/11.0/lib/clang/11.0.0">\\LLVM\\11.0\\lib\\clang\\11.0.0</a>"
 -internal-isystem "C:\\Program Files (x86)<a href="file://LLVM/11.0/lib/clang/11.0.0/include">\\LLVM\\11.0\\lib\\clang\\11.0.0\\include</a>" -internal-isystem "C:\\Program Files (x86)<a href="file://Microsoft">\\Microsoft</a> Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\include"
 -internal-isystem "C:\\Program Files (x86)<a href="file://Microsoft">\\Microsoft</a> Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\atlmfc\\include" -internal-isystem "C:\\Program Files (x86)<a href="file://Windows">\\Windows</a> Kits\\10\\Include\\10.0.18362.0\\ucrt"
 -internal-isystem "C:\\Program Files (x86)<a href="file://Windows">\\Windows</a> Kits\\10\\include\\10.0.18362.0\\shared" -internal-isystem "C:\\Program Files (x86)<a href="file://Windows">\\Windows</a> Kits\\10\\include\\10.0.18362.0\\um" -internal-isystem
 "C:\\Program Files (x86)<a href="file://Windows">\\Windows</a> Kits\\10\\include\\10.0.18362.0\\winrt" -fdebug-compilation-dir "D:\\projects\\as400\\rpg\\clang" -ferror-limit 19 -fmessage-length=194 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.28.29335
 -fdelayed-template-parsing -fcolor-diagnostics -faddrsig -o e-m32.ll -x c e.c<br>
clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target i686-pc-windows-msvc<br>
#include "..." search starts here:<br>
#include <...> search starts here:<br>
 C:\Program Files (x86)\LLVM\11.0\lib\clang\11.0.0\include<br>
 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include<br>
 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\atlmfc\include<br>
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt<br>
 C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared<br>
 C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um<br>
 C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt<br>
End of search list.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal">lli hw-m64.ll<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hello World!<o:p></o:p></p>
</blockquote>
<p class="MsoNormal">lli hw-m32.ll<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">PLEASE submit a bug report to <a href="https://bugs.llvm.org/">
https://bugs.llvm.org/</a> and include the crash backtrace.<br>
Stack dump:<br>
0.      Program arguments: D:\\llvm-project\\build32\\Debug\\bin\\lli hw-m32.ll<br>
 #0 0x04b8eacc<br>
 #1 0x03ff017b<br>
 #2 0x03ff032b<br>
 #3 0x0153ca18 llvm::MCJIT::runFunction(class llvm::Function *, class llvm::ArrayRef<struct llvm::GenericValue>) D:\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp:587:0<br>
 #4 0x01459673 llvm::ExecutionEngine::runFunctionAsMain(class llvm::Function *, class std::vector<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::allocator<class std::basic_string<char, struct std::char_traits<char>,
 class std::allocator<char>>>> const &, char const *const *) D:\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp:467:0<br>
 #5 0x007e08c5 main D:\llvm-project\llvm\tools\lli\lli.cpp:643:0<br>
 #6 0x02e12013 invoke_main d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0<br>
 #7 0x02e11e97 _scrt_common_main_seh d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0<br>
 #8 0x02e11d2d _scrt_common_main d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0<br>
 #9 0x02e12098 mainCRTStartup d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0<br>
#10 0x75336359 (C:\WINDOWS\System32\KERNEL32.DLL+0x16359)<br>
#11 0x774c8944 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x68944)<br>
#12 0x774c8914 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x68914)<o:p></o:p></p>
</blockquote>
<p>What is the best way to debug the 32 bit arch lli.exe under VS2019?<o:p></o:p></p>
<p><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">D:\projects\clang>type hw.c<br>
#include <stdio.h><br>
int main() {<br>
        printf("Hello World!\n");<br>
        return 0;<br>
}<o:p></o:p></p>
</div>
</body>
</html>