Hi Jim,

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:

 (lldb) target create "/home/projects/zz.wasm"
Current executable set to '/home/projects/zz.wasm' (wasm32).
(lldb) b main
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.

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.

BR,
Terry

On Wed, Aug 28, 2019 at 1:27 AM Jim Ingham <jing...@apple.com> wrote:
>
> You would need to implement an ObjectFile and SymbolFile plugin for your
.wasm files for lldb to make a Target for them.
>
> Jim
>
>
> > On Aug 26, 2019, at 6:27 PM, Terry Guo via lldb-dev <
lldb-dev@lists.llvm.org> wrote:
> >
> > Hi Raphael,
> >
> > Thanks for your recommendation. How about the very first step which
> > enables LLDB to recognize the wasm bytecode via commands like "lldb
> > my.wasm" or "file my.wasm" inside lldb? And IMHO the second step is to
> > enable LLDB to recognize the dwarf sections embedded in wasm bytecode
> > file. Do you have any suggestion where to start? I searched around and
> > couldn't find useful instructions/documentations for above two steps.
> >
> > BR,
> > Terry
> >
> >
> > On Mon, Aug 26, 2019 at 7:03 PM Raphael “Teemperor” Isemann
> > <teempe...@gmail.com> wrote:
> >>
> >> +lldb-dev
> >>
> >> On 26. Aug 2019, at 12:57, Raphael “Teemperor” Isemann <
teempe...@gmail.com> wrote:
> >>
> >> If I understand correctly your VM is your own custom wasm
interpreter/JIT? If yes, then I don’t think it is realistic that LLDB can
ever support it out of the box. But you can write a LLDB plugin that calls
your own interpreter-implementations of functions such as
stepping/continue/settings breakpoints, etc. Quick google search shows this
example of doing the same for the Ruby interpreter that hopefully
illustrates what I mean:
https://christoph.luppri.ch/articles/ruby/debugging-ruby-programs-on-osx-with-lldb/
> >>
> >> - Raphael
> >>
> >> On 26. Aug 2019, at 12:37, Terry Guo <flame...@gmail.com> wrote:
> >>
> >> Hi Raphael,
> >>
> >> Thanks. I mean the first case, attaching to my vm and then debugging
via LLDB like setting breakpoint, single step or viewing the memory of wasm
application.
> >>
> >> BR,
> >> Terry
> >>
> >> On Mon, Aug 26, 2019 at 5:59 PM Raphael “Teemperor” Isemann <
teempe...@gmail.com> wrote:
> >>>
> >>> I’m not sure I understand what the question is. Do you want that LLDB
attachs to the wasm program running inside your VM and then debug the wasm
program via LLDB? Or that LLDB can run the wasm module itself like an
executable and then run it/step through it/inspect it/etc.?
> >>>
> >>> Cheers,
> >>> - Raphael
> >>>
> >>>> On 26. Aug 2019, at 11:47, Terry Guo via lldb-dev <
lldb-dev@lists.llvm.org> wrote:
> >>>>
> >>>> Hi there,
> >>>>
> >>>> I am working on a project which involves compiling C++ source file
to Webassembly byte code file with LLVM. The LLVM works well and can
generate wasm byte code file with DWARF debug sections like .debug_line. I
can run the generated wasm file with my wasm virtual machine. However I
find LLDB doesn't support debugging wasm file. Do we have plan to enable
LLDB debugging wasm file? Thanks for any information.
> >>>>
> >>>> BR,
> >>>> Terry
> >>>> _______________________________________________
> >>>> lldb-dev mailing list
> >>>> lldb-dev@lists.llvm.org
> >>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> >>>
> >>
> >>
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to