mchoo7 wrote:
This doesn't solve the issue:
```console
$ ~/llvm/main/build/bin/lldb prog
(lldb) target create "prog"
Current executable set to '/home/mchoo/aux/prog' (x86_64).
(lldb) breakpoint set -n main
Breakpoint 1: where = prog`main, address = 0x00000000002016f0
(lldb) r
Process 38203 launched: '/home/mchoo/aux/prog' (x86_64)
Process 38203 stopped
* thread #1, name = 'prog', stop reason = breakpoint 1.1
frame #0: 0x00000000002016f0 prog`main
prog`main:
-> 0x2016f0 <+0>: pushq %rbp
0x2016f1 <+1>: movq %rsp, %rbp
0x2016f4 <+4>: subq $0x10, %rsp
0x2016f8 <+8>: movl $0x0, -0x4(%rbp)
(lldb) image list
[ 0] DB2ECC80 0x0000000000200000 /home/mchoo/aux/prog
[ 1] A2749E1F 0x000000082219b000 /home/mchoo/aux/libfilter.so
[ 2] D4962071 0x00001572f3b68000 /libexec/ld-elf.so.1
[ 3] 95FF671B 0x000000082264b000 /lib/libc.so.7
[ 4] F5F3BA30 0x00000008232ad000 /lib/libsys.so.7
[ 5] 99116A9F 0x0000000823d13000 /home/mchoo/aux/libfiltee.so
(lldb) p (char *)foo()
(char *) 0x000000082219b468 "defined in filter"
(lldb) continue
Process 38203 resuming
foo is defined in filtee: bar is defined in filter
Process 38203 exited with status = 0 (0x00000000)
(lldb) quit
```
```c
// filtee.c
const char *foo(void)
{
return "defined in filtee";
}
```
```c
// filter.c
const char *bar = "defined in filter";
const char *foo(void)
{
return "defined in filter";
}
```
```c
// main.c
#include <stdio.h>
extern const char *bar;
extern const char *foo(void);
int main(void)
{
printf("foo is %s: bar is %s\n", foo(), bar);
return 0;
}
```
Compiled with:
```console
$ cc -fPIC -shared -Wl,-soname,libfiltee.so -o libfiltee.so filtee.c
$ cc -fPIC -shared -Wl,-soname,libfilter.so -Wl,-f,libfiltee.so \
-Wl,-rpath,'$ORIGIN' -o libfilter.so filter.c
$ cc -o prog main.c -L. -lfilter -Wl,-rpath,'$ORIGIN'
```
https://github.com/llvm/llvm-project/pull/208905
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits