<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/94574>94574</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            LLDB hangs at O0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          YangYibiao
      </td>
    </tr>
</table>

<pre>
    `$ clang --version`

> Ubuntu clang version 19.0.0 (++20240301064251+dd426fa5f931-1~exp1~20240301184412.1845)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/lib/llvm-19/bin

`$ lldb --version`

> lldb version 19.0.0

`$ cat small.c`

> typedef struct
> {
>   int baddr;
> } mstruct_t;

> static struct
> {
> unsigned int    mapnum;
>   mstruct_t       unused;
> } mtab;

> static mstruct_t *mactab = &mtab.unused;

> int
> main(void)
> {
>   int i;
>   int addr;

>   for (i=1; i <= mtab.mapnum; i++)
>     if (addr < mactab[i].baddr)
>       break;
> return 0;
> }

`$ clang -O0 -g small.c; lldb a.out`

> (lldb) target create "a.out"
> Current executable set to '/root/a.out' (x86_64).
> (lldb) b main
> Breakpoint 1: where = a.out`main + 11 at small.c:20:9, address = 0x000000000000113b
> (lldb) r
> Process 26442 launched: '/root/a.out' (x86_64)
> [1344/3230] Manually indexing DWARF: libc.so.6...

The code you provided is causing LLDB to hang after setting a breakpoint at main and attempting to run the program. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVU2P4zYP_jXKhYghU_6IDz7E6zfAC2yxRbFFsaeFLCuOWlkK9DGbuexvL2TPTJLZYFAfAkckH5IPH8rcezUZKVtSdqTsNzyGk3XtN26mb2pQ3G4GOz63pKIECxCamwm22yfpvLImndKe0P3LL_sf_DlEE-KL44sb5E1GMwoEdwQ7gh1SLCijOa0KLHOC3TgWWB15eWxYvs1_yss5__nqlO-KI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