int main () { int res = 0; res = (intptr_t)malloc(sizeof(1000)); // L1 printf("res = %d\n", res); // L2 return res; } Compiled with -g, optionally -ffreestanding -fno-builtin. Break point on L1 and step (command: s) - program ends (with res printed). - this is also observed for memmove, memcpy (on -ffreestanding -fno-builtin) Break point on L2 and step (command: s) - goes into printf. Looks like a (somewhat tricky) feature tuned (whitelist) for libc? LLDB behaves like my expectation: step on L1 will stop at L2. DWARF debug info (lines) looks correct. Affects many versions of gdb/gcc. Reproduced on: - 11.0.50.20201224-git (GCC 10.2.0) - Ubuntu 9.2-0ubuntu1~20.04 (GCC 9.3) Seems duplicate with #25565.
In old version of GDB (GNU gdb (GDB) 9.0.50.20191210-git), it behaves as correct. (see PR#25565) Thus, I think this should be a bug rather than a feature.
Duplicate. *** This bug has been marked as a duplicate of bug 27151 ***