Issue |
131241
|
Summary |
[clang] [asan] PDB is missing variable when compiled with address sanitizer
|
Labels |
clang
|
Assignees |
|
Reporter |
MarkMendell
|
I noticed when debugging my program that sometimes variables would be unavailable to the debugger. I tried multiple debuggers, then inspected the PDB and noticed the variable was missing. I determined that disabling address sanitizer would cause the variable to return in the debug information. I subsequently whittled down my program to a small one that would reproduce the issue.
With the below program, the variable `memval` will be present in the PDB when compiled without address sanitizer, but not available when compiled with address sanitizer. I am using llvm 20.1.0 built from source, and I got the source from the github release.
`foo.c`:
```c
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
long
bar(char **ps, int *perr)
{
return 0;
}
int
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int err = 0;
char *memval = "test";
if (bar(&memval,&err)) return 0;
return 0;
}
```
```sh
$ clang.exe foo.c -g -fsanitize=address -o foo.exe && llvm-pdbutil.exe dump -modi=0000 --symbols foo.pdb | grep memval && echo yay
$ clang.exe foo.c -g -o foo.exe && llvm-pdbutil.exe dump -modi=0000 --symbols foo.pdb | grep memval && echo yay
512 | S_LOCAL [size = 20] `memval`
yay
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs