[lldb-dev] Pending breakpoints to dlsym()ed functions

Dmitry Antipov via lldb-dev lldb-dev at lists.llvm.org
Thu Feb 15 03:56:01 PST 2018


On 02/15/2018 02:21 PM, Pavel Labath wrote:

> 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. 

I've changed my sample to dlsym() a regular function instead of an indirect
stub, and got a breakpoint hit, but:

(lldb) attach 16196
Process 16196 stopped
* thread #1, name = 'main', stop reason = signal SIGSTOP
     frame #0: 0x0000000000400798 main`main(argc=1, argv=0x00007ffd6f662668) at main.c:16
    13  	  for (a = 0; a < DELAY + argc; a++)
    14  	    for (b = 0; b < DELAY + argc; b++)
    15  	      for (c = 0; c < DELAY + argc; c++)
-> 16  	        z += a + b + c;
    17  	  while (1)
    18  	    {
    19  	      void *handle = dlopen ("libfoo.so", RTLD_LAZY);

Executable module set to "/home/dantipov/tmp/t-dl2/main".
Architecture set to: x86_64--linux.
(lldb) breakpoint set -n foo
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) process continue
Process 16196 resuming
1 location added to breakpoint 1
(lldb) error: ld-linux-x86-64.so.2 0x0005d207: adding range [0x14eea-0x14f5a) which has a base that is less than the function's low PC 0x15730. Please file a bug and attach the file at the start of 
this error message
error: ld-linux-x86-64.so.2 0x0005d207: adding range [0x14f70-0x14f76) which has a base that is less than the function's low PC 0x15730. Please file a bug and attach the file at the start of this 
error message
error: ld-linux-x86-64.so.2 0x0005d268: adding range [0x14eea-0x14f5a) which has a base that is less than the function's low PC 0x15730. Please file a bug and attach the file at the start of this 
error message
error: ld-linux-x86-64.so.2 0x0005d268: adding range [0x14f70-0x14f76) which has a base that is less than the function's low PC 0x15730. Please file a bug and attach the file at the start of this 
error message
Process 16196 stopped
* thread #1, name = 'main', stop reason = breakpoint 1.1
     frame #0: 0x00007f3b1a8536f7 libfoo.so`foo(v=0.00000000000003907985046680551) at libfoo.c:6
    3   	double
    4   	foo (double v)
    5   	{
-> 6   	  return sin (v) + cos (v);
    7   	}

This seems to be an another bug, isn't it?

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.
-----------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libfoo.c
Type: text/x-csrc
Size: 73 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180215/c47fc918/attachment-0002.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180215/c47fc918/attachment-0003.c>
-------------- next part --------------
all: libfoo.so main

libfoo.so: libfoo.c
	gcc -fPIC -O0 -g3 -shared -o libfoo.so libfoo.c -lm

main: main.c
	gcc -O0 -g3 -o main main.c -ldl

clean:
	rm -f libfoo.so main


More information about the lldb-dev mailing list