llvm / llvm/llvm-project

LLDB does not respect standard and auxiliary filters

Open
#180,860 1 comment 0 reactions 0 assignees View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

This issue was discovered while working on #180444. This below output is retrieved from Fedora 43.

From https://docs.oracle.com/cd/E19683-01/817-3677/6mj8mbtbr/index.html#chapter4-5:

Source code:
```c
// filtee.c
char * bar = "defined in filtee";

char * foo()
{
return("defined in filtee");
}
```

```c
// filter.c
char * bar = "defined in filter";

char * foo()
{
return ("defined in filter");
}
```

```c
// main.c
#include
extern char * bar, * foo();

int main()
{
(void) printf("foo is %s: bar is %s\n", foo(), bar);
}
```

Compile:
`gcc -fPIC -shared -o filtee.so.1 filtee.c`
`gcc -fPIC -shared -o filter.so.1 filter.c -Wl,-f,filtee.so.1 -Wl,-h,filter.so.1 -Wl,-rpath,.` (standard)
`gcc -fPIC -shared -o filter.so.1 filter.c -Wl,-F,filtee.so.1 -Wl,-h,filter.so.1 -Wl,-rpath,.` (auxiliary)
`gcc -o prog main.c -Wl,-rpath,. filter.so.1`

Expected Output (gdb):
```console
(gdb) b main
(gdb) r
(gdb) p (char *)foo()
$1 = 0x7ffff7db1218 "defined in filtee"
(gdb) c
Continuing.
foo is defined in filtee: bar is defined in filter
...
```

Real Output (lldb):
```console
(lldb) breakpoint set -n main
(lldb) run
(lldb) print (char *)foo()
(char *) 0x00007ffff7fb8268 "defined in filter"
(lldb) c
Process 4287 resuming
foo is defined in filtee: bar is defined in filter
...
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the filtee.c, filter.c, and main.c examples and the listed GCC and LLDB commands, then compare LLDB's result with GDB's. Trace the LLDB handling of ELF standard and auxiliary filters; done means foo() resolves to the filtee while bar remains from the filter, for both filter forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.