<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 9, 2019 at 10:59 PM Greg Clayton <<a href="mailto:clayborg@gmail.com">clayborg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><br><div><br><blockquote type="cite"><div>On Sep 9, 2019, at 7:07 AM, Terry Guo via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="gmail-m_-5525688697566998377Apple-interchange-newline"><div><div dir="ltr">Hi Jim,<br><br>Thanks for your help. I implemented a WASM file plugin under folder Plugins/ObjectFile/WASM. Now the LLDB can make a target for .wasm file. My .wasm file is built with clang and -g option. It does contain dwarf informations spreaded in a series of .debug_xx sections. However I failed to set breakpoint against a function name:<div><br><div> (lldb) target create "/home/projects/zz.wasm"<br>Current executable set to '/home/projects/zz.wasm' (wasm32).<br>(lldb) b main<br>Breakpoint 1: no locations (pending).<br>WARNING:  Unable to resolve breakpoint to any actual locations.</div><div><br></div><div>Is this related to Symtab? Currently I left function "Symtab *ObjectFileWASM::GetSymtab()" as empty function because the .wasm file doesn't include one. Or should I make LLDB to utilize the .debug_line information? I couldn't figure out which information should be used to enable LLDB to correctly set the breakpoint. Thanks in advance.</div></div></div></div></blockquote><div><br></div>The ObjectFile subclasses are asked to create sections with the virtual:</div><div><br></div><div>  virtual void ObjectFile::CreateSections(SectionList &unified_section_list) = 0;</div><div><br></div><div>In this function you must correctly create sections and give them appropriate lldb::<span style="background-color:rgb(255,255,255)">SectionType enum values. For ".debug_info", this should be </span><span style="background-color:rgb(255,255,255)">eSectionTypeDWARFDebugInfo. There are many others. Check out the other ObjectFile subclasses like </span><span style="background-color:rgb(255,255,255)">ObjectFilePECOFF::CreateSections() to see how they do this. Many object files have different naming mechanisms and restrictions (mach-o can only have 16 character section names in ObjectFileMachO), so we leave the conversion of section types to each ObjectFile since they can use flags, section names, and more to determine what kind of sections are available from their specific object file. Code that uses DWARF will ask for a section using lldb::SectionType values. If you fix this, the DWARF should be found and parsed and you might be able to set a breakpoint. We also do this to avoid code having to ask for sections by name, and then retry all sorts of different section names (".debug_info" for most, then fall back to "__debug_info" for mach-o, and add more for different object files in the future). This keeps the code that needs to access DWARF cleaner.</span></div><div><span style="background-color:rgb(255,255,255)"><br></span></div><div><span style="background-color:rgb(255,255,255)">Greg</span></div><div><br></div></div></blockquote><div> </div><div>Got it and Thanks Greg.</div><div><br></div><div>BR,</div><div>Terry </div></div></div>