Re: [lldb-dev] JIT debugging on Mac OSX

2017-06-13 Thread Stefan Gränitz via lldb-dev
Hello everyone, Haitao, Greg, Keno

Reviving this topic as I am investigating the current state of JITed
code debugging in LLVM release 4.0 for our upcoming LLVM Social in
Berlin. Following the docs I got everything working on Linux (for a side
note see 0):
http://llvm.org/docs/DebuggingJITedCode.html

On OSX it doesn't work as there's a special check preventing
JITLoaderGDB instantiation:

ArchSpec arch (process->GetTarget().GetArchitecture());
if (arch.GetTriple().getVendor() != llvm::Triple::Apple)
  jit_loader_sp.reset(new JITLoaderGDB(process));

Trying to reconstruct history: The check was introduced due to a
performance issuein 2014 (see 1). Shortly afterwards Keno Fischer
submitted his implementation for MachO support and in the original
patch, the OSX limitation was removed as I'd expected(see 2). However,
in the final LLDB commit these lines remained inside (see 3), I guess
because the performance issue was still present? IIUC this was
onlysolved in 2015 with a special option to enable the JIT loader
breakpoint (see 4). Though the check for llvm::Triple::Apple is still in
there..

So I guess there are more reasons why JITed code debugging is still not
available on OSX?

Just removing the line, doesn't get me anywhere (see terminal output in
5). Although LLI's __jit_debug_register_code and __jit_debug_descriptor
symbols are found correctly, the jit-debug-register breakpoint set in
JITLoaderGDB::SetJITBreakpoint will never be hit, so source locations
are not resolved and debug symbols not available.

It would be great to hear if anyone knows more about the topic, how to
fix or workaround it, or maybe alternative ways to get it done on OSX.

Thanks
Stefan

--

(0) The docs could be updated as the mentioned lli flag recently changed
from "-use-mcjit" to "-jit-kind=mcjit". Also it won't work with
"-jit-kind=orc-mcjit" as  OrcMCJITReplacement does not register
GDBRegistrationListener as MCJIT does:
https://github.com/llvm-mirror/llvm/blob/master/lib/ExecutionEngine/MCJIT/MCJIT.cpp#L90

(1) 07.04.2014:
Disable JITLoaderGDB on "vendor == apple" for now due to performance
slowdowns [...]
https://github.com/llvm-mirror/lldb/commit/2829ee8e179e9d3381de08dba1502351e34867c0

(2) 03.06.2014:
Allow MachO JIT debugging (Review)
https://reviews.llvm.org/D4006#C84943OL290

(3) 25.06.2014:
[...] enable JITLoaderGDB with mach-o file support
https://github.com/llvm-mirror/lldb/commit/a900ab69519016161cd640643776b55a1e56ad84
https://github.com/llvm-mirror/lldb/blob/a900ab69519016161cd640643776b55a1e56ad84/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp#L367

(4) 16.09.2015:
[...] make JIT loader breakpoint optional
https://github.com/llvm-mirror/lldb/commit/4066cc33b57758fbc94afc3428c52e817a65c201

(5) Debugging JITed code with LLDB & LLVM Release 4.0 on OSX 10.12:

(lldb) target create "/Dev/3rdParty/llvm40-build-xcode/Debug/bin/lli"
Current executable set to
'/Dev/3rdParty/llvm40-build-xcode/Debug/bin/lli' (x86_64).
(lldb) settings set -- target.run-args  "-O0" "-jit-kind=mcjit"
"/Dev/Personal/jitdebug/foo.ll"
(lldb) log enable lldb jit
(lldb) settings set plugin.jit-loader.gdb.enable-jit-breakpoint true
(lldb) b foo.c:4
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) run
JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
JITLoaderGDB::SetJITBreakpoint setting JIT breakpoint
Process 7433 launched: '/Dev/3rdParty/llvm40-build-xcode/Debug/bin/lli'
(x86_64)
Process 7433 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason =
EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000103fd000c
->  0x103fd000c: movl   (%rcx), %esi
0x103fd000e: movabsq $0x103fd1000, %rdi; imm = 0x103FD1000
0x103fd0018: movabsq $0x7fffcb06f180, %rcx ; imm = 0x7FFFCB06F180
0x103fd0022: xorl   %eax, %eax
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason =
EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x000103fd000c
frame #1: 0x000103fd0050
frame #2: 0x000103fd0070
frame #3: 0x000103fd009b
frame #4: lli`llvm::MCJIT::runFunction(this=0x000106806200,
F=0x000104003238, ArgValues=ArrayRef @
0x7fff5fbfacd0) at MCJIT.cpp:538
frame #5:
lli`llvm::ExecutionEngine::runFunctionAsMain(this=0x000106806200,
Fn=0x000104003238, argv=size=1, envp=0x7fff5fbff708) at
ExecutionEngine.cpp:471
frame #6: lli`main(argc=6, argv=0x7fff5fbff6d0,
envp=0x7fff5fbff708) at lli.cpp:632
frame #7: 0x7fffcaff6235 libdyld.dylib`start + 1

On Sat Jul 6 05:58:39 PDT 2013 HaiTao Feng wrote:
> Hi,
>
> How does JIT debugging feature work on Mac OSX?
>
> It seems that some LLVM documents implied lldb supports JIT debugging on
> Mac OSX.
>   1) "LLDB may be a better option for debugging JIT-ed code on Mac OS X."
> from http://llvm.org/docs/DebuggingJITedCode.html.
>   2)  "Upcoming features include JIT debugging, core file support and
> support of new processor features." in the 

[lldb-dev] [5.0.0 Release] Schedule and call for testers

2017-06-13 Thread Hans Wennborg via lldb-dev
Hello everyone,

We're about a month away from the start of the 5.0.0 release process,
so it's time for the traditional schedule and call for testers email.

If you'd like to help providing binaries and testing for your
favourite platform, please let me know and subscribe to the
release-testers mailing list [1].

This time I will try to delegate a bit more. It's very easy to end up
working full time on scanning the commit lists, bisecting bugs, and
merging patches --- and I don't have that much time to spend.
Especially for bug squashing, I'm hoping to get more of the community
involved somehow. Please let me know if you have ideas here.

I propose the following schedule for the 5.0.0 release:

- 19 July 2017: Create the 5.0 branch, tag RC1 soon after, trunk becomes 6.0.0.

- 9 August: Tag RC2; all lose ends should be tied up by now.

- 23 August: Final tag. Binaries and release announcement a few days later.

Unless there are any concerns, I'll post this on the web page soon.

Thanks,
Hans


 [1] http://lists.llvm.org/mailman/listinfo/release-testers
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] LLVM Social - Paris: June 14th, 2017

2017-06-13 Thread Arnaud Allard de Grandmaison via lldb-dev
Friendly reminder : the Paris LLVM social is today !

There are a few seats left, but not much.

Registration free but mandatory at : http://www.meetup.com/LLVM-Clang-social

See you thee !
-- Arnaud de Grandmaison, Duncan Sands, Sylvestre Ledru


On Tue, May 30, 2017 at 11:58 AM, Arnaud Allard de Grandmaison <
arnaud.ad...@gmail.com> wrote:

> The next LLVM social in Paris will happen on June 14th, 2017.
>
> Everyone interested in LLVM, Clang, lldb, Polly, lld, ... is invited to
> join.
>
> Event details, including registration (free but mandatory) at
> http://www.meetup.com/LLVM-Clang-social
>
> This edition will be particularly busy (and interesting !) as we are
> delighted to welcome 3 guest speakers:
>
>- Hal Finkel (Argonne National Laboratory) will present a shortened
>and updated version of his EuroLLVM'17 keynote "*Exascale computing,
>LLVM, and representations of parallelism*". He will also present the
>work he has done on a type sanitizer.
>- David Chisnall (Cambridge University) will talk about "*Targeting
>architectures where pointers are not integers with LLVM*".
>- Tobias Grosser (ETH Zürich) will present the "*Efforts to make Polly
>production quality*".
>
> Looking forward to meet you,
> -- Arnaud de Grandmaison, Duncan Sands, Sylvestre Ledru
>
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev