<div dir="ltr"><div dir="ltr"><div> Hi, all:</div><div> Thanks for your answer. Maybe my description is not clear enough. MLExecuteTest.exe is just a shell to compile and execute TestFunctin.cpp, the step is below: </div><div> 1. call llvm function to compile TestFunction.cpp, this will create module ,function, block, instruction, and generate binary code with debug info;</div><div> 2. it uses JIT ExecuteEnginie to execute the binary code.</div><div> and what I use lldb to debug is the binary code generated from TestFunction.cpp. So I am not concerned about the pdb of MLExecuteTest.exe.</div><div> </div><div> According to your suggestion, I have debug lldb source code, set breakpoint in SymbolFilePDB::ResolveSymbolContext, but not come in this function. Since I think my debug info is all generated by llvm tegother with IR in the first phrase, which is all contained in binary code. I don't know in the second phrase, while JIT load binary code to generate execute process, weather JIT will meanwhile generate some other debug info in PDB forms on windows platform, if so, which library in llvm do this work, and how does lldb load these PDB symbols. Because if PDB needs to be generated, maybe this is what I missed. </div><div> </div><div> On the other hand, I've debug the lldb to see what happens in CompileUnit::ResolveSymbolContext, and found that every debug line can be parsed from DWARFDebugLine.cpp, then the function FindLineEntryIndexByFileIndex in LinTable.cpp will find whether the file_addr of line entry is contained in file addresses of section list(I don't know the reason why lldb do this). But the result is the file_addr of each line can not be found from the section list addresses. So at last lines are not found, breakpoint not hit.</div><div><br></div><div> I have added some code in notifyObjectLoaded function from GDBRegistrationListener.cpp to store the middle ELF data. Sections and debug_line details can be seen by the readelf linux command. Can you help me to analyse the debug info in ELF, check whether there is anything wrong in debug info, which causes breakpoints not to be hit. </div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>the TestFunction.cpp and its ELF data is brought in attachment.</div><div><br></div><div>Thanks,</div><div>le wang</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Greg Clayton <<a href="mailto:clayborg@gmail.com">clayborg@gmail.com</a>> 于2020年10月20日周二 上午7:23写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">As long as the location TestFunction.cpp:1 has a valid line in the PDB line tables, this breakpoint should be hit if there is debug info and the internal PDB parser is parsing things correctly. If you have debug info in your binary, _and_ if LLDB is able to locate your PDB file, then you should end up seeing a location if it was found. We can see this isn't happening:<br>
<br>
(lldb)br s -fE:/test/TestFunction.cpp -l1<br>
Breakpoint 1: no locations(pending).<br>
WARNING : Unable to resolve breakpoint to any actual locations.<br>
<br>
I would suggest debugging the LLDB and debugging:<br>
<br>
uint32_t SymbolFilePDB::ResolveSymbolContext(const lldb_private::FileSpec &file_spec, uint32_t line, bool check_inlines, SymbolContextItem resolve_scope, lldb_private::SymbolContextList &sc_list);<br>
<br>
This function is what turns the file (in "file_spec") and line (in "line") into a symbol context list (in "sc_list"). A SymbolContext is a class that defines a complete symbol file context for something. It contains a Module (executable), CompileUnit (if there is debug info for the source file), Function (if there is debug info for the function), Block (lexical block of the deepest lexical block that contains the start address for the file + line), LineEntry (source file and line number, which might have a line number greater than what you requested if there was no perfect match), and Symbol (symbol from the symbol table). We have a symbol context list, because you might have multiple matches for a given source file and line if your functions was inlined.<br>
<br>
You might try just doing:<br>
<br>
(lldb) b TestFunction.cpp:1<br>
<br>
And seeing if that helps. If the debug information doesn't contain the exact same path of "E:/test/TestFunction.cpp", it might not set the breapoint if the path in the debug info contains symlinks or is a relative path.<br>
<br>
Does anyone know if the "pdb" file shows up when doing "image list" in LLDB? On mac if we have a stand alone debug info file, we show it below the executable:<br>
<br>
(lldb) target create "/tmp/a.out"<br>
Current executable set to '/tmp/a.out' (x86_64).<br>
(lldb) image list a.out<br>
[ 0] E76A2647-AFB4-3950-943A-CB1D701B7C07 0x0000000100000000 /tmp/a.out <br>
/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out<br>
<br>
<br>
If you do a "image list" on your executable, it would be interesting to see if the pdb file shows up in this output.<br>
<br>
Greg Clayton<br>
<br>
> On Oct 17, 2020, at 1:51 AM, le wang via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> Hello,everyone:<br>
> I have a problem when download llvm10.0.1 and use lldb to debug my process on windows10 x64 platform. but with no debug point hit.<br>
> the command is<br>
> (lldb)target create "D:/code/MLExecuteTest.exe"<br>
> Current executable set to 'D:/code/MLExecuteTest.exe' (x86_64) <br>
> (lldb)br s -fE:/test/TestFunction.cpp -l1<br>
> Breakpoint 1: no locations(pending).<br>
> WARNING : Unable to resolve breakpoint to any actual locations.<br>
> (lldb)r<br>
> Process 16228 launched 'D:/code/MLExecuteTest.exe'<br>
> Process 16228 exited with status = 1(0x00000001)<br>
> my using detail is this below:<br>
> MLExecuteTest.exe is my process which will first compile the script TestFunction.cpp on debug mode and generate binary code in its memory, of course binary code has debug information, and then it use JIT ExecuteEngine to execute the binary code. I want to know, is llvm 10.0.1 support this using on windows platform. since before we use llvm5.0 on windows platform is OK, breakpoints can be hit. but while update version to 10.0.1, with same operation ,breakpoints can not be hit. so is llvm10.0.1 support or has any changes on this using on windows platform? <br>
> <br>
> Thanks,<br>
> le wang<br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div>