+ eugene as the "most recent person who worked on the DYLD plugin" :D
Hi Dmitry, I've tried your sample, and I was indeed able to reproduce the problem. What makes your case special is that "sin" and "cos" are indirect functions (STT_GNU_IFUNC), so we have to do some extra work (call the resolver function) to resolve them. Doing that while we're in the process of loading a module seems to be going south. There seem to two things going wrong here which contribute to the overall effect of "hanging": 1: We resolve the address of the resolver function as 0xfff..., presumably because the module is not fully initialized yet. 2: Calling that address results in an inferior SEGV-ing, but for some reason InferiorCall function does not detect that. (Probably also has something to do with the "in the middle of module load" context) A trivial fix would be to avoid calling an obviously wrong address, but that's not going to solve your immediate problem (just prevent the hang). May I suggest you file a bug with this information and we'll see what we can do about that. As a workaround, you can try setting the breakpoint on the symbol that the IFUNC will eventually resolve to (in my case that would be __sin_avx). Not an ideal solution, but I can't think of anything better now. On 15 February 2018 at 07:39, Dmitry Antipov via lldb-dev <lldb-dev@lists.llvm.org> wrote: > I'm trying to setup a pending breakpoint for sin() and cos() which are > dlsym()ed from libm.so > (sample attached), and an attempt to continue execution seems just hangs the > debugger. For example: > > (lldb) attach 17043 > Process 17043 stopped > * thread #1, name = 't-dlopen', stop reason = signal SIGSTOP > frame #0: 0x0000000000400728 t-dlopen`main(argc=1, > argv=0x00007ffd2b0a00c8) at t-dlopen.c:21 > 18 for (a = 0; a < DELAY + argc; a++) > 19 for (b = 0; b < DELAY + argc; b++) > 20 for (c = 0; c < DELAY + argc; c++) > -> 21 z += a + b + c; > 22 while (1) > 23 { > 24 void *handle = dlopen (LIBM_SO, RTLD_LAZY); > > Executable module set to "/home/dantipov/tmp/t-dlopen". > Architecture set to: x86_64--linux. > (lldb) breakpoint set -n sin > Breakpoint 1: no locations (pending). > WARNING: Unable to resolve breakpoint to any actual locations. > (lldb) breakpoint set -n cos > Breakpoint 2: no locations (pending). > WARNING: Unable to resolve breakpoint to any actual locations. > (lldb) process continue ;; After this, nothing > happens for a long time > Process 17043 resuming > (lldb) process status ;; After this, lldb > hangs and have to be killed > > I've tried 6.0.0-rc2 as well as 7.0.0 svn trunk 325127, with the same > disappointing results. > > Dmitry > > ----------------------------------------------------------------------------------- > This email message is for the sole use of the intended recipient(s) and may > contain > confidential information. Any unauthorized review, use, disclosure or > distribution > is prohibited. If you are not the intended recipient, please contact the > sender by > reply email and destroy all copies of the original message. > ----------------------------------------------------------------------------------- > > _______________________________________________ > lldb-dev mailing list > lldb-dev@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev > _______________________________________________ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev