[llvm] [LoongArch] Add debug location for register reload (PR #122057)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 01:08:06 PST 2025


heiher wrote:

> > Here is another similar issue:
> > ```
> > $ gdb ./t
> > GNU gdb (GDB) 15.1
> > ...
> > (gdb) b *main
> > Breakpoint 1 at 0x760: file t.c, line 2.
> > (gdb) r
> > ...
> > Breakpoint 1, main (argc=<error reading variable: Cannot access memory at address 0xffffffffffffffe8>, 
> >     argv=<error reading variable: Cannot access memory at address 0xffffffffffffffe0>) at t.c:2
> > 2	int main(int argc, char **argv) {
> > ```
> 
> This is correct. `argc` and `argv` are calculated through `fp`, where `argc = $r22 - 24` and `argv = r22 - 32`. When breaking at `*main`, `$r22 = 0`, and at this point, argc and argv are inaccessible.

I agree. Throwing an inaccessible result is better than GCC displaying the spurious zero value.

```
Breakpoint 1, main (argc=0, argv=0x0) at t.c:2
```

https://github.com/llvm/llvm-project/pull/122057


More information about the llvm-commits mailing list